Skip to content
Snippets Groups Projects
Commit f9f13f0f authored by Arran Walker's avatar Arran Walker
Browse files

Upgrade Go to 1.21.1

parent c7ca3d14
Branches
No related tags found
No related merge requests found
...@@ -72,9 +72,6 @@ to clean-up build results. ...@@ -72,9 +72,6 @@ to clean-up build results.
## Tests and validation ## Tests and validation
We use the usual `go` tools for this, to run those commands you need at least the linter which you can
install with `go get -u golang.org/x/lint/golint`
To run basic validation (fmt, test-short, lint, vet), and the project unit tests, call: To run basic validation (fmt, test-short, lint, vet), and the project unit tests, call:
$ make test $ make test
......
FROM golang:1.12.9 FROM golang:1.21.1
RUN apt-get update && apt-get install -y --no-install-recommends \ RUN apt-get update && apt-get install -y --no-install-recommends \
openssh-client \ openssh-client \
rsync \ rsync \
fuse \ fuse3 \
sshfs \ sshfs \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
ENV GO111MODULE=on ENV GO111MODULE=on
RUN go get golang.org/x/tools@v0.1.12
RUN go get golang.org/x/lint/golint
RUN go get golang.org/x/tools/cover
ENV GO111MODULE=off
ENV USER root ENV USER root
WORKDIR /go/src/github.com/docker/machine WORKDIR /go/src/github.com/docker/machine
......
...@@ -10,7 +10,7 @@ environment: ...@@ -10,7 +10,7 @@ environment:
clone_folder: c:\gopath\src\github.com\docker\machine clone_folder: c:\gopath\src\github.com\docker\machine
build_script: build_script:
- go build -i -o ./bin/docker-machine.exe ./cmd/docker-machine - go build -o ./bin/docker-machine.exe ./cmd/docker-machine
test_script: test_script:
- powershell -Command go test -v ./libmachine/shell - powershell -Command go test -v ./libmachine/shell
......
//go:build !windows
// +build !windows // +build !windows
package commands package commands
......
//go:build 386 || amd64
// +build 386 amd64 // +build 386 amd64
package virtualbox package virtualbox
......
//go:build !386 && !amd64
// +build !386,!amd64 // +build !386,!amd64
package virtualbox package virtualbox
......
//go:build !darwin
// +build !darwin // +build !darwin
package vmwarefusion package vmwarefusion
......
...@@ -93,9 +93,11 @@ func (e ErrPluginBinaryNotFound) Error() string { ...@@ -93,9 +93,11 @@ func (e ErrPluginBinaryNotFound) Error() string {
} }
// driverPath finds the path of a driver binary by its name. // driverPath finds the path of a driver binary by its name.
// + If the driver is a core driver, there is no separate driver binary. We reuse current binary if it's `docker-machine` // - If the driver is a core driver, there is no separate driver binary. We reuse current binary if it's `docker-machine`
//
// or we assume `docker-machine` is in the PATH. // or we assume `docker-machine` is in the PATH.
// + If the driver is NOT a core driver, then the separate binary must be in the PATH and it's name must be // - If the driver is NOT a core driver, then the separate binary must be in the PATH and it's name must be
//
// `docker-machine-driver-driverName` // `docker-machine-driver-driverName`
func driverPath(driverName string) string { func driverPath(driverName string) string {
for _, coreDriver := range CoreDrivers { for _, coreDriver := range CoreDrivers {
......
//go:build !windows
// +build !windows // +build !windows
package shell package shell
......
//go:build !windows
// +build !windows // +build !windows
package shell package shell
......
...@@ -3,11 +3,7 @@ GO_LDFLAGS := -X `go list ./version`.GitCommit=`git rev-parse --short HEAD 2>/de ...@@ -3,11 +3,7 @@ GO_LDFLAGS := -X `go list ./version`.GitCommit=`git rev-parse --short HEAD 2>/de
GO_GCFLAGS := GO_GCFLAGS :=
# Full package list # Full package list
PKGS := $(shell go list -tags "$(BUILDTAGS)" ./... | grep -v "/vendor/" | grep -v "/cmd") PKGS := $(shell go list -tags "$(BUILDTAGS)" ./... | grep -v "/cmd")
# Resolving binary dependencies for specific targets
GOLINT_BIN := $(GOPATH)/bin/golint
GOLINT := $(shell [ -x $(GOLINT_BIN) ] && echo $(GOLINT_BIN) || echo '')
# Honor debug # Honor debug
ifeq ($(DEBUG),true) ifeq ($(DEBUG),true)
......
fmt: fmt:
@test -z "$$(gofmt -s -l . 2>&1 | grep -v vendor/ | tee /dev/stderr)" @go mod download
@test -z "$$(gofmt -s -l . 2>&1 | tee /dev/stderr)"
vet: vet:
@go mod download
@test -z "$$(go vet $(PKGS) 2>&1 | tee /dev/stderr)" @test -z "$$(go vet $(PKGS) 2>&1 | tee /dev/stderr)"
lint: lint:
$(if $(GOLINT), , \ @go mod download
$(error Please install golint: go get -u golang.org/x/lint/golint)) @go install golang.org/x/lint/golint@latest
@test -z "$$($(GOLINT) ./... 2>&1 | grep -v vendor/ | grep -v "cli/" | grep -v "amazonec2/" |grep -v "openstack/" |grep -v "softlayer/" | grep -v "should have comment" | tee /dev/stderr)" @test -z "$$(golint ./... 2>&1 | grep -v "cli/" | grep -v "amazonec2/" |grep -v "openstack/" |grep -v "softlayer/" | grep -v "should have comment" | tee /dev/stderr)"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment