diff --git a/.github/workflows/go-cross.yml b/.github/workflows/go-cross.yml
index 71c2613a6..cb31888f3 100644
--- a/.github/workflows/go-cross.yml
+++ b/.github/workflows/go-cross.yml
@@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
- go-version: [1.16.x]
+ go-version: [1.16.x, 1.17.x]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
diff --git a/.github/workflows/go-lint.yml b/.github/workflows/go-lint.yml
index 15d60f6b7..1b85ed7b4 100644
--- a/.github/workflows/go-lint.yml
+++ b/.github/workflows/go-lint.yml
@@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
- go-version: [1.16.x]
+ go-version: [1.16.x, 1.17.x]
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml
index 9faf36b67..432b65e99 100644
--- a/.github/workflows/go.yml
+++ b/.github/workflows/go.yml
@@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
- go-version: [1.16.x]
+ go-version: [1.16.x, 1.17.x]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
diff --git a/buildscripts/gen-ldflags.go b/buildscripts/gen-ldflags.go
index aa7c7c709..c7ce900bc 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/disk-cache-check-support_contrib_windows.go b/cmd/disk-cache-check-support_contrib_windows.go
index b4dc4605a..e5599eb17 100644
--- a/cmd/disk-cache-check-support_contrib_windows.go
+++ b/cmd/disk-cache-check-support_contrib_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
/*
diff --git a/cmd/disk-cache-check-support_other.go b/cmd/disk-cache-check-support_other.go
index e1e3906b3..2465071af 100644
--- a/cmd/disk-cache-check-support_other.go
+++ b/cmd/disk-cache-check-support_other.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/cmd/os-dirent_fileino.go b/cmd/os-dirent_fileino.go
index 04cca402f..a3522e902 100644
--- a/cmd/os-dirent_fileino.go
+++ b/cmd/os-dirent_fileino.go
@@ -1,3 +1,4 @@
+//go:build freebsd || openbsd || netbsd
// +build freebsd openbsd netbsd
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/cmd/os-dirent_ino.go b/cmd/os-dirent_ino.go
index b83dbe499..09f2debea 100644
--- a/cmd/os-dirent_ino.go
+++ b/cmd/os-dirent_ino.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 (linux || darwin) && !appengine
// +build linux darwin
// +build !appengine
diff --git a/cmd/os-dirent_namelen_bsd.go b/cmd/os-dirent_namelen_bsd.go
index 74a8e8138..7ac6ecad6 100644
--- a/cmd/os-dirent_namelen_bsd.go
+++ b/cmd/os-dirent_namelen_bsd.go
@@ -1,3 +1,4 @@
+//go:build darwin || freebsd || openbsd || netbsd
// +build darwin freebsd openbsd netbsd
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/cmd/os-dirent_namelen_linux.go b/cmd/os-dirent_namelen_linux.go
index acb09eb45..14c442394 100644
--- a/cmd/os-dirent_namelen_linux.go
+++ b/cmd/os-dirent_namelen_linux.go
@@ -1,3 +1,4 @@
+//go:build linux && !appengine
// +build linux,!appengine
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/cmd/os-readdir_other.go b/cmd/os-readdir_other.go
index ed97c4627..4e31ff3b1 100644
--- a/cmd/os-readdir_other.go
+++ b/cmd/os-readdir_other.go
@@ -1,3 +1,4 @@
+//go:build plan9 || solaris
// +build plan9 solaris
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/cmd/os-readdir_unix.go b/cmd/os-readdir_unix.go
index dd4f7dc1a..437726d52 100644
--- a/cmd/os-readdir_unix.go
+++ b/cmd/os-readdir_unix.go
@@ -1,3 +1,4 @@
+//go:build (linux && !appengine) || darwin || freebsd || netbsd || openbsd
// +build linux,!appengine darwin freebsd netbsd openbsd
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/cmd/os-readdir_windows.go b/cmd/os-readdir_windows.go
index 09ed0b9d7..572e49a12 100644
--- a/cmd/os-readdir_windows.go
+++ b/cmd/os-readdir_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 06cc57e06..55c8915d7 100644
--- a/cmd/update_fips.go
+++ b/cmd/update_fips.go
@@ -1,3 +1,4 @@
+//go:build fips
// +build fips
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/cmd/update_nofips.go b/cmd/update_nofips.go
index 95dbd2aa9..148f8168c 100644
--- a/cmd/update_nofips.go
+++ b/cmd/update_nofips.go
@@ -1,3 +1,4 @@
+//go:build !fips
// +build !fips
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/cmd/xl-storage_noatime_notsupported.go b/cmd/xl-storage_noatime_notsupported.go
index 438174812..ac6718ef6 100644
--- a/cmd/xl-storage_noatime_notsupported.go
+++ b/cmd/xl-storage_noatime_notsupported.go
@@ -1,3 +1,4 @@
+//go:build windows || darwin || freebsd
// +build windows darwin freebsd
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/cmd/xl-storage_noatime_supported.go b/cmd/xl-storage_noatime_supported.go
index 4dc43163a..eefeef87c 100644
--- a/cmd/xl-storage_noatime_supported.go
+++ b/cmd/xl-storage_noatime_supported.go
@@ -1,3 +1,4 @@
+//go:build !windows && !darwin && !freebsd
// +build !windows,!darwin,!freebsd
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/cmd/xl-storage_unix_test.go b/cmd/xl-storage_unix_test.go
index 5c5bebb01..8a8da2893 100644
--- a/cmd/xl-storage_unix_test.go
+++ b/cmd/xl-storage_unix_test.go
@@ -1,3 +1,4 @@
+//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd
// +build linux darwin dragonfly freebsd netbsd openbsd
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/cmd/xl-storage_windows_test.go b/cmd/xl-storage_windows_test.go
index 27e01bf0e..1b44ed275 100644
--- a/cmd/xl-storage_windows_test.go
+++ b/cmd/xl-storage_windows_test.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/docs/sts/assume-role.go b/docs/sts/assume-role.go
index 72fcfc333..861870a93 100644
--- a/docs/sts/assume-role.go
+++ b/docs/sts/assume-role.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/docs/sts/client-grants.go b/docs/sts/client-grants.go
index ea8ba7728..9a98ee442 100644
--- a/docs/sts/client-grants.go
+++ b/docs/sts/client-grants.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/docs/sts/ldap.go b/docs/sts/ldap.go
index a39a75aee..d4759cb31 100644
--- a/docs/sts/ldap.go
+++ b/docs/sts/ldap.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/docs/sts/web-identity.go b/docs/sts/web-identity.go
index 23c16e800..b7a12bc93 100644
--- a/docs/sts/web-identity.go
+++ b/docs/sts/web-identity.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/config/certs_test.go b/internal/config/certs_test.go
index be1fe4c25..036adfd81 100644
--- a/internal/config/certs_test.go
+++ b/internal/config/certs_test.go
@@ -18,10 +18,8 @@
package config
import (
- "fmt"
"io/ioutil"
"os"
- "runtime"
"testing"
)
@@ -155,39 +153,27 @@ M9ofSEt/bdRD
}
defer os.Remove(tempFile5)
- nonexistentErr := fmt.Errorf("open nonexistent-file: no such file or directory")
- if runtime.GOOS == "windows" {
- // Below concatenation is done to get rid of goline error
- // "error strings should not be capitalized or end with punctuation or a newline"
- nonexistentErr = fmt.Errorf("open nonexistent-file:" + " The system cannot find the file specified.")
- }
-
testCases := []struct {
certFile string
expectedResultLen int
- expectedErr error
+ expectedErr bool
}{
- {"nonexistent-file", 0, nonexistentErr},
- {tempFile1, 0, fmt.Errorf("Empty public certificate file %s", tempFile1)},
- {tempFile2, 0, fmt.Errorf("Could not read PEM block from file %s", tempFile2)},
- {tempFile3, 0, fmt.Errorf("asn1: structure error: sequence tag mismatch")},
- {tempFile4, 1, nil},
- {tempFile5, 2, nil},
+ {"nonexistent-file", 0, true},
+ {tempFile1, 0, true},
+ {tempFile2, 0, true},
+ {tempFile3, 0, true},
+ {tempFile4, 1, false},
+ {tempFile5, 2, false},
}
for _, testCase := range testCases {
certs, err := ParsePublicCertFile(testCase.certFile)
-
- if testCase.expectedErr == nil {
- if err != nil {
- t.Fatalf("error: expected = , got = %v", err)
- }
- } else if err == nil {
- t.Fatalf("error: expected = %v, got = ", testCase.expectedErr)
- } else if testCase.expectedErr.Error() != err.Error() {
- t.Fatalf("error: expected = %v, got = %v", testCase.expectedErr, err)
+ if !testCase.expectedErr && err != nil {
+ t.Fatalf("error: expected = , got = %v", err)
+ }
+ if testCase.expectedErr && err == nil {
+ t.Fatal("error: expected err, got = ")
}
-
if len(certs) != testCase.expectedResultLen {
t.Fatalf("certs: expected = %v, got = %v", testCase.expectedResultLen, len(certs))
}
diff --git a/internal/config/identity/openid/ecdsa-sha3_contrib.go b/internal/config/identity/openid/ecdsa-sha3_contrib.go
index 37a02db11..b3af99d48 100644
--- a/internal/config/identity/openid/ecdsa-sha3_contrib.go
+++ b/internal/config/identity/openid/ecdsa-sha3_contrib.go
@@ -11,6 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//go:build !fips
// +build !fips
package openid
diff --git a/internal/config/identity/openid/rsa-sha3_contrib.go b/internal/config/identity/openid/rsa-sha3_contrib.go
index 49fee73eb..ccb596d4b 100644
--- a/internal/config/identity/openid/rsa-sha3_contrib.go
+++ b/internal/config/identity/openid/rsa-sha3_contrib.go
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+//go:build !fips
// +build !fips
package openid
diff --git a/internal/disk/directio_unix.go b/internal/disk/directio_unix.go
index 907a88878..ba659e52b 100644
--- a/internal/disk/directio_unix.go
+++ b/internal/disk/directio_unix.go
@@ -1,3 +1,4 @@
+//go:build linux || netbsd || freebsd
// +build linux netbsd freebsd
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/directio_unsupported.go b/internal/disk/directio_unsupported.go
index c63edacc0..c60b69cdc 100644
--- a/internal/disk/directio_unsupported.go
+++ b/internal/disk/directio_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !linux && !netbsd && !freebsd && !darwin
// +build !linux,!netbsd,!freebsd,!darwin
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/disk_test.go b/internal/disk/disk_test.go
index eafe08fa4..9ee7219b3 100644
--- a/internal/disk/disk_test.go
+++ b/internal/disk/disk_test.go
@@ -1,3 +1,4 @@
+//go:build !netbsd && !solaris
// +build !netbsd,!solaris
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/disk_unix.go b/internal/disk/disk_unix.go
index 5c5a8f786..a7cfabf57 100644
--- a/internal/disk/disk_unix.go
+++ b/internal/disk/disk_unix.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/disk_windows.go b/internal/disk/disk_windows.go
index 182793546..0412ab9b4 100644
--- a/internal/disk/disk_windows.go
+++ b/internal/disk/disk_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/fdatasync_linux.go b/internal/disk/fdatasync_linux.go
index 6f12551ef..19b3982d5 100644
--- a/internal/disk/fdatasync_linux.go
+++ b/internal/disk/fdatasync_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/fdatasync_unix.go b/internal/disk/fdatasync_unix.go
index 3b758cf5e..80e3e3cd7 100644
--- a/internal/disk/fdatasync_unix.go
+++ b/internal/disk/fdatasync_unix.go
@@ -1,3 +1,4 @@
+//go:build freebsd || netbsd || openbsd || darwin
// +build freebsd netbsd openbsd darwin
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/fdatasync_unsupported.go b/internal/disk/fdatasync_unsupported.go
index f5699e4de..a3f8b6b38 100644
--- a/internal/disk/fdatasync_unsupported.go
+++ b/internal/disk/fdatasync_unsupported.go
@@ -1,3 +1,4 @@
+//go:build !linux && !netbsd && !freebsd && !darwin && !openbsd
// +build !linux,!netbsd,!freebsd,!darwin,!openbsd
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/stat_bsd.go b/internal/disk/stat_bsd.go
index a51d8d294..0c3a2717a 100644
--- a/internal/disk/stat_bsd.go
+++ b/internal/disk/stat_bsd.go
@@ -1,3 +1,4 @@
+//go:build darwin || dragonfly
// +build darwin dragonfly
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/stat_freebsd.go b/internal/disk/stat_freebsd.go
index a19c3720a..8063da2bc 100644
--- a/internal/disk/stat_freebsd.go
+++ b/internal/disk/stat_freebsd.go
@@ -1,3 +1,4 @@
+//go:build freebsd
// +build freebsd
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/stat_linux.go b/internal/disk/stat_linux.go
index 246e50bf0..d35f8e372 100644
--- a/internal/disk/stat_linux.go
+++ b/internal/disk/stat_linux.go
@@ -1,3 +1,4 @@
+//go:build linux && !s390x && !arm && !386
// +build linux,!s390x,!arm,!386
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/stat_linux_32bit.go b/internal/disk/stat_linux_32bit.go
index f58699535..633e3f489 100644
--- a/internal/disk/stat_linux_32bit.go
+++ b/internal/disk/stat_linux_32bit.go
@@ -1,3 +1,4 @@
+//go:build (linux && arm) || (linux && 386)
// +build linux,arm linux,386
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/stat_linux_s390x.go b/internal/disk/stat_linux_s390x.go
index 5d18ce29d..f97883a68 100644
--- a/internal/disk/stat_linux_s390x.go
+++ b/internal/disk/stat_linux_s390x.go
@@ -1,3 +1,4 @@
+//go:build linux && s390x
// +build linux,s390x
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/stat_netbsd.go b/internal/disk/stat_netbsd.go
index b089f9910..4bb307594 100644
--- a/internal/disk/stat_netbsd.go
+++ b/internal/disk/stat_netbsd.go
@@ -1,3 +1,4 @@
+//go:build netbsd
// +build netbsd
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/stat_openbsd.go b/internal/disk/stat_openbsd.go
index b0333b9c0..64beba0e3 100644
--- a/internal/disk/stat_openbsd.go
+++ b/internal/disk/stat_openbsd.go
@@ -1,3 +1,4 @@
+//go:build openbsd
// +build openbsd
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/stat_solaris.go b/internal/disk/stat_solaris.go
index f1abbdb63..b5d0b27c2 100644
--- a/internal/disk/stat_solaris.go
+++ b/internal/disk/stat_solaris.go
@@ -1,3 +1,4 @@
+//go:build solaris
// +build solaris
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/stat_windows.go b/internal/disk/stat_windows.go
index d73b4e9b7..dc727b13d 100644
--- a/internal/disk/stat_windows.go
+++ b/internal/disk/stat_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/type_bsd.go b/internal/disk/type_bsd.go
index 22d91cbfc..5212864e3 100644
--- a/internal/disk/type_bsd.go
+++ b/internal/disk/type_bsd.go
@@ -1,3 +1,4 @@
+//go:build darwin || freebsd || dragonfly || openbsd || solaris
// +build darwin freebsd dragonfly openbsd solaris
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/type_linux.go b/internal/disk/type_linux.go
index 54bc1b1eb..37788d2b8 100644
--- a/internal/disk/type_linux.go
+++ b/internal/disk/type_linux.go
@@ -1,3 +1,4 @@
+//go:build linux && !s390x && !arm && !386
// +build linux,!s390x,!arm,!386
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/disk/type_windows.go b/internal/disk/type_windows.go
index 37a076407..cd17aa01f 100644
--- a/internal/disk/type_windows.go
+++ b/internal/disk/type_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/fips/fips.go b/internal/fips/fips.go
index 4cdd063a6..fd07cc49f 100644
--- a/internal/fips/fips.go
+++ b/internal/fips/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 && linux && amd64
// +build fips,linux,amd64
package fips
diff --git a/internal/fips/no_fips.go b/internal/fips/no_fips.go
index e447d519f..b874caee7 100644
--- a/internal/fips/no_fips.go
+++ b/internal/fips/no_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 fips
diff --git a/internal/hash/sha256_fips.go b/internal/hash/sha256_fips.go
index fc38d5c4e..65c7a924d 100644
--- a/internal/hash/sha256_fips.go
+++ b/internal/hash/sha256_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 hash
diff --git a/internal/hash/sha256_nofips.go b/internal/hash/sha256_nofips.go
index 6a6761844..960122f6d 100644
--- a/internal/hash/sha256_nofips.go
+++ b/internal/hash/sha256_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 hash
diff --git a/internal/http/dial_linux.go b/internal/http/dial_linux.go
index 7197f98c1..520332951 100644
--- a/internal/http/dial_linux.go
+++ b/internal/http/dial_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/http/dial_others.go b/internal/http/dial_others.go
index 33c07e762..d36357b63 100644
--- a/internal/http/dial_others.go
+++ b/internal/http/dial_others.go
@@ -1,3 +1,4 @@
+//go:build !linux
// +build !linux
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/http/listen_nix.go b/internal/http/listen_nix.go
index 35e10dc32..6efa253e2 100644
--- a/internal/http/listen_nix.go
+++ b/internal/http/listen_nix.go
@@ -1,3 +1,4 @@
+//go:build linux || darwin || dragonfly || freebsd || netbsd || openbsd || rumprun
// +build linux darwin dragonfly freebsd netbsd openbsd rumprun
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/http/listen_others.go b/internal/http/listen_others.go
index 4a1dd074f..dc7876c60 100644
--- a/internal/http/listen_others.go
+++ b/internal/http/listen_others.go
@@ -1,3 +1,4 @@
+//go:build windows || plan9 || solaris
// +build windows plan9 solaris
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/ioutil/append-file_nix.go b/internal/ioutil/append-file_nix.go
index 27154b189..cd1de6082 100644
--- a/internal/ioutil/append-file_nix.go
+++ b/internal/ioutil/append-file_nix.go
@@ -1,3 +1,4 @@
+//go:build !windows
// +build !windows
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/ioutil/read_file_noatime_notsupported.go b/internal/ioutil/read_file_noatime_notsupported.go
index 8543b626e..9438371e7 100644
--- a/internal/ioutil/read_file_noatime_notsupported.go
+++ b/internal/ioutil/read_file_noatime_notsupported.go
@@ -1,3 +1,4 @@
+//go:build windows || darwin || freebsd
// +build windows darwin freebsd
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/ioutil/read_file_noatime_supported.go b/internal/ioutil/read_file_noatime_supported.go
index 8b966f46d..3726e44bb 100644
--- a/internal/ioutil/read_file_noatime_supported.go
+++ b/internal/ioutil/read_file_noatime_supported.go
@@ -1,3 +1,4 @@
+//go:build !windows && !darwin && !freebsd
// +build !windows,!darwin,!freebsd
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/lock/lock_nix.go b/internal/lock/lock_nix.go
index d64edf6db..548457ed4 100644
--- a/internal/lock/lock_nix.go
+++ b/internal/lock/lock_nix.go
@@ -1,3 +1,4 @@
+//go:build !windows && !plan9 && !solaris
// +build !windows,!plan9,!solaris
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/lock/lock_solaris.go b/internal/lock/lock_solaris.go
index 3012ce375..8d7bcfd58 100644
--- a/internal/lock/lock_solaris.go
+++ b/internal/lock/lock_solaris.go
@@ -1,3 +1,4 @@
+//go:build solaris
// +build solaris
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/lock/lock_windows.go b/internal/lock/lock_windows.go
index f1908fbb7..6d0deb3ae 100644
--- a/internal/lock/lock_windows.go
+++ b/internal/lock/lock_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/lock/lock_windows_test.go b/internal/lock/lock_windows_test.go
index 263c164c7..84bcc017a 100644
--- a/internal/lock/lock_windows_test.go
+++ b/internal/lock/lock_windows_test.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/mountinfo/mountinfo.go b/internal/mountinfo/mountinfo.go
index b062d1e31..7ae706551 100644
--- a/internal/mountinfo/mountinfo.go
+++ b/internal/mountinfo/mountinfo.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/mountinfo/mountinfo_linux.go b/internal/mountinfo/mountinfo_linux.go
index 803f6b074..c2db4c05e 100644
--- a/internal/mountinfo/mountinfo_linux.go
+++ b/internal/mountinfo/mountinfo_linux.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/mountinfo/mountinfo_linux_test.go b/internal/mountinfo/mountinfo_linux_test.go
index eb6457ef7..3a49bd9c3 100644
--- a/internal/mountinfo/mountinfo_linux_test.go
+++ b/internal/mountinfo/mountinfo_linux_test.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/mountinfo/mountinfo_others.go b/internal/mountinfo/mountinfo_others.go
index 0ada5d3cc..14b6d049e 100644
--- a/internal/mountinfo/mountinfo_others.go
+++ b/internal/mountinfo/mountinfo_others.go
@@ -1,3 +1,4 @@
+//go:build !linux && !windows
// +build !linux,!windows
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/mountinfo/mountinfo_windows.go b/internal/mountinfo/mountinfo_windows.go
index 7b27f824d..244da9aa9 100644
--- a/internal/mountinfo/mountinfo_windows.go
+++ b/internal/mountinfo/mountinfo_windows.go
@@ -1,3 +1,4 @@
+//go:build windows
// +build windows
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/s3select/genmessage.go b/internal/s3select/genmessage.go
index a1c53d56e..a26adaff4 100644
--- a/internal/s3select/genmessage.go
+++ b/internal/s3select/genmessage.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/s3select/unused-errors.go b/internal/s3select/unused-errors.go
index 33545e353..818215e9e 100644
--- a/internal/s3select/unused-errors.go
+++ b/internal/s3select/unused-errors.go
@@ -1,3 +1,4 @@
+//go:build ignore
// +build ignore
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/smart/nvme.go b/internal/smart/nvme.go
index 7370070d8..f23d3a4d8 100644
--- a/internal/smart/nvme.go
+++ b/internal/smart/nvme.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/internal/smart/smart.go b/internal/smart/smart.go
index ac88249a6..aaf4eb667 100644
--- a/internal/smart/smart.go
+++ b/internal/smart/smart.go
@@ -1,3 +1,4 @@
+//go:build linux
// +build linux
// Copyright (c) 2015-2021 MinIO, Inc.
diff --git a/main_contrib_test.go b/main_contrib_test.go
index f8707c7bf..76af072cb 100644
--- a/main_contrib_test.go
+++ b/main_contrib_test.go
@@ -1,3 +1,4 @@
+//go:build testrunmain
// +build testrunmain
/*