From 2f7be10b5d7b2483c60866d6ffbfbdcc70d0178c Mon Sep 17 00:00:00 2001 From: Eric Coissac Date: Fri, 13 Mar 2026 19:03:22 +0100 Subject: [PATCH] Build improvements and Go version update - Update Go version from 1.25.0 to 1.26.1 in go.mod and go.work - Fix Makefile: quote LDFLAGS to handle spaces safely in -ldflags - Improve build error handling: on failure, cat log then cleanup and exit with error code - Update install_obitools.sh: properly set GOROOT, GOPATH, and GOTOOLCHAIN; ensure GOPATH directory is created --- Makefile | 4 ++-- go.mod | 2 +- go.work | 2 +- install_obitools.sh | 10 ++++++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 8cd2a0c..56d7c47 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ NC := \033[0m GOFLAGS= LDFLAGS= GOCMD=go -GOBUILD=$(GOCMD) build $(GOFLAGS) $(if $(LDFLAGS),-ldflags='$(LDFLAGS)') +GOBUILD=$(GOCMD) build $(GOFLAGS) $(if $(LDFLAGS),-ldflags="$(LDFLAGS)") GOGENERATE=$(GOCMD) generate GOCLEAN=$(GOCMD) clean GOTEST=$(GOCMD) test @@ -51,7 +51,7 @@ $(OBITOOLS_PREFIX)$(notdir $(1)): $(BUILD_DIR) $(1) pkg/obioptions/version.go @echo -n - Building obitool $(notdir $(1))... @$(GOBUILD) -o $(BUILD_DIR)/$(OBITOOLS_PREFIX)$(notdir $(1)) ./$(1) \ 2> $(OBITOOLS_PREFIX)$(notdir $(1)).log \ - || cat $(OBITOOLS_PREFIX)$(notdir $(1)).log + || { cat $(OBITOOLS_PREFIX)$(notdir $(1)).log; rm -f $(OBITOOLS_PREFIX)$(notdir $(1)).log; exit 1; } @rm -f $(OBITOOLS_PREFIX)$(notdir $(1)).log @echo Done. endef diff --git a/go.mod b/go.mod index 911da83..5a02ac4 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module git.metabarcoding.org/obitools/obitools4/obitools4 -go 1.25.0 +go 1.26.1 require ( github.com/DavidGamba/go-getoptions v0.33.0 diff --git a/go.work b/go.work index a860ee3..e4243b4 100644 --- a/go.work +++ b/go.work @@ -1,3 +1,3 @@ -go 1.25.0 +go 1.26.1 use . diff --git a/install_obitools.sh b/install_obitools.sh index 3e05d1a..9248d44 100755 --- a/install_obitools.sh +++ b/install_obitools.sh @@ -185,14 +185,16 @@ echo "Installing Go from: $GOURL" 1>&2 curl --progress-bar "$GOURL" | tar zxf - -PATH="$(pwd)/go/bin:$PATH" +export GOROOT="$(pwd)/go" +PATH="${GOROOT}/bin:$PATH" export PATH -GOPATH="$(pwd)/go" -export GOPATH +export GOPATH="$(pwd)/gopath" export GOCACHE="$(pwd)/cache" +export GOTOOLCHAIN=local +echo "GOROOT=$GOROOT" 1>&2 echo "GOCACHE=$GOCACHE" 1>&2 -mkdir -p "$GOCACHE" +mkdir -p "$GOPATH" "$GOCACHE" # Download OBITools4 source echo "Downloading OBITools4 v${VERSION}..." 1>&2