diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index dc5a1b37..fc05d017 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -9,10 +9,12 @@ jobs: build: name: Test on Go ${{ matrix.go-version }} and ${{ matrix.os }} runs-on: ${{ matrix.os }} + env: + GO111MODULE: on strategy: matrix: - go-version: [1.16.x] - os: [ubuntu-latest, windows-latest] + go-version: [1.16.x, 1.17.x] + os: [ubuntu-latest, macos-latest, windows-latest] steps: - name: Set up Go ${{ matrix.go-version }} on ${{ matrix.os }} uses: actions/setup-go@v1 @@ -25,20 +27,37 @@ jobs: - name: Build on ${{ matrix.os }} if: matrix.os == 'windows-latest' - env: - GO111MODULE: on run: | go build --ldflags="-s -w" -o %GOPATH%\bin\mc.exe go test -v -race --timeout 30m ./... + - name: Build on ${{ matrix.os }} + if: matrix.os == 'macos-latest' + run: | + go build --ldflags="-s -w" -o %GOPATH%\bin\mc + go test -v -race --timeout 30m ./... - name: Build on ${{ matrix.os }} if: matrix.os == 'ubuntu-latest' - env: - GO111MODULE: on run: | make - diff -au <(gofmt -d *.go) <(printf "") - diff -au <(gofmt -s -d cmd) <(printf "") - diff -au <(gofmt -s -d pkg) <(printf "") make test-race make verify make crosscompile + vetchecks: # Run vet checks against one version. + env: + CGO_ENABLED: 0 + runs-on: ubuntu-latest + steps: + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.17.x + + - name: Checkout code + uses: actions/checkout@v2 + + - name: fmt + run: diff -au <(gofmt -s -d .) <(printf "") + + - name: Test 386 + run: GOOS=linux GOARCH=386 go test -short ./... + diff --git a/buildscripts/gen-ldflags.go b/buildscripts/gen-ldflags.go index db246c5a..1171083a 100644 --- a/buildscripts/gen-ldflags.go +++ b/buildscripts/gen-ldflags.go @@ -1,3 +1,4 @@ +//go:build ignore // +build ignore // Copyright (c) 2015-2021 MinIO, Inc. diff --git a/cmd/client-fs_darwin.go b/cmd/client-fs_darwin.go index 619c2d46..c746fdbf 100644 --- a/cmd/client-fs_darwin.go +++ b/cmd/client-fs_darwin.go @@ -1,3 +1,4 @@ +//go:build darwin // +build darwin // Copyright (c) 2015-2021 MinIO, Inc. diff --git a/cmd/client-fs_linux.go b/cmd/client-fs_linux.go index efffebd8..178e30c3 100644 --- a/cmd/client-fs_linux.go +++ b/cmd/client-fs_linux.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux // Copyright (c) 2015-2021 MinIO, Inc. diff --git a/cmd/client-fs_other.go b/cmd/client-fs_other.go index 754d9efd..ec364136 100644 --- a/cmd/client-fs_other.go +++ b/cmd/client-fs_other.go @@ -1,3 +1,4 @@ +//go:build solaris || openbsd // +build solaris openbsd // Copyright (c) 2015-2021 MinIO, Inc. diff --git a/cmd/client-fs_windows.go b/cmd/client-fs_windows.go index 96a6a485..121f36a1 100644 --- a/cmd/client-fs_windows.go +++ b/cmd/client-fs_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows // Copyright (c) 2015-2021 MinIO, Inc. diff --git a/cmd/find_test.go b/cmd/find_test.go index 4a5eb8d1..eaf2ea54 100644 --- a/cmd/find_test.go +++ b/cmd/find_test.go @@ -20,6 +20,7 @@ package cmd import ( "context" "os/exec" + "runtime" "strings" "testing" "time" @@ -421,6 +422,10 @@ func TestStringReplace(t *testing.T) { // Tests exit status, getExitStatus() function func TestGetExitStatus(t *testing.T) { + if runtime.GOOS != "linux" { + t.Skip("Skipping on non-linux") + return + } testCases := []struct { command string expectedExitStatus int diff --git a/cmd/fs-pathutils_nix.go b/cmd/fs-pathutils_nix.go index 2c8d27b5..37d3d0ba 100644 --- a/cmd/fs-pathutils_nix.go +++ b/cmd/fs-pathutils_nix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows // Copyright (c) 2015-2021 MinIO, Inc. diff --git a/cmd/fs-pathutils_windows.go b/cmd/fs-pathutils_windows.go index 37fecbcc..1be67a1b 100644 --- a/cmd/fs-pathutils_windows.go +++ b/cmd/fs-pathutils_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows // Copyright (c) 2015-2021 MinIO, Inc. diff --git a/cmd/update_fips.go b/cmd/update_fips.go index 7e2921a8..b06b8a69 100644 --- a/cmd/update_fips.go +++ b/cmd/update_fips.go @@ -15,6 +15,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +//go:build fips // +build fips package cmd diff --git a/cmd/update_nofips.go b/cmd/update_nofips.go index 1c601585..73981dc6 100644 --- a/cmd/update_nofips.go +++ b/cmd/update_nofips.go @@ -15,6 +15,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +//go:build !fips // +build !fips package cmd diff --git a/go.mod b/go.mod index 7ad429cd..25ec981f 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/minio/mc -go 1.14 +go 1.16 require ( github.com/briandowns/spinner v1.16.0 diff --git a/main.go b/main.go index 6de2111a..ed3181d3 100644 --- a/main.go +++ b/main.go @@ -1,5 +1,3 @@ -// +build go1.13 - // Copyright (c) 2015-2021 MinIO, Inc. // // This file is part of MinIO Object Storage stack diff --git a/pkg/disk/stat_darwin.go b/pkg/disk/stat_darwin.go index b3417cc4..a669e3e0 100644 --- a/pkg/disk/stat_darwin.go +++ b/pkg/disk/stat_darwin.go @@ -1,3 +1,4 @@ +//go:build darwin // +build darwin // Copyright (c) 2015-2021 MinIO, Inc. diff --git a/pkg/disk/stat_linux.go b/pkg/disk/stat_linux.go index c27bd18b..626941f1 100644 --- a/pkg/disk/stat_linux.go +++ b/pkg/disk/stat_linux.go @@ -1,3 +1,4 @@ +//go:build linux // +build linux // Copyright (c) 2015-2021 MinIO, Inc. diff --git a/pkg/disk/stat_other.go b/pkg/disk/stat_other.go index 7906615a..b5604ecc 100644 --- a/pkg/disk/stat_other.go +++ b/pkg/disk/stat_other.go @@ -1,3 +1,4 @@ +//go:build openbsd || solaris // +build openbsd solaris // Copyright (c) 2015-2021 MinIO, Inc. diff --git a/pkg/disk/stat_windows.go b/pkg/disk/stat_windows.go index eb075add..311f7553 100644 --- a/pkg/disk/stat_windows.go +++ b/pkg/disk/stat_windows.go @@ -1,3 +1,4 @@ +//go:build windows // +build windows // Copyright (c) 2015-2021 MinIO, Inc.