Skip to content

Commit

Permalink
go: Fix go update
Browse files Browse the repository at this point in the history
- Change who we get TARGET dir not to be based on GOROOT
- Change display of TARGET using realpath
- Change latest sematnics to use internal /go
- Change latest link location to be inside of repo
  • Loading branch information
mmatczuk committed Dec 1, 2020
1 parent c21576b commit 4b76f55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ Scylla Manager consists of tree components:

The desired Go version is specified in `.go-version` file.
You can install or update Go version by running `make install` in `go` directory.
It would install the required version alongside your current version assuming that go is extracted from an official tar package.
If you do not have any Go installed at this point you can pass TARGET variable to specify a directory where to install Go.

**Procedure**:

1. Define `GOROOT` environment variable as `/PATH/TO/GO/SDKS/latest`
1. Run `make -C go install`

This would download required go version and install it at `GOROOT`.
1. Run `make -C go install TARGET=/path/to/go/sdks/goversion` example `make install TARGET=~/tools/go/go1.15.5.linux-amd64`
1. Define `GOROOT` environment variable as `<git-root>/go/latest`

## Installing other packages needed for development

Expand Down
8 changes: 2 additions & 6 deletions go/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@ $(GO_BUNDLE):

.PHONY: install
install: $(GO_BUNDLE)
install: TARGET=$(shell dirname $(GOROOT))/go$(GO_VERSION).linux-amd64
install: TARGET=$(shell realpath -m $(shell which go)../../../../../go$(GO_VERSION).linux-amd64)
install:
ifndef GOROOT
$(error set GOROOT environment variable as '/PATH/TO/GO/SDKS/latest')
endif
@echo "==> Installing Go $(GO_VERSION) to $(TARGET)..."
@[ -d $(TARGET) ] || (mkdir -p $(TARGET) && tar -xzf $(GO_BUNDLE) -C $(TARGET))
@rm -f `dirname $(TARGET)`/latest
@ln -sf $(TARGET)/go `dirname $(TARGET)`/latest
@rm -f latest && ln -sf $(TARGET)/go latest

.PHONY: clean
clean:
Expand Down

0 comments on commit 4b76f55

Please sign in to comment.