Skip to content

Commit

Permalink
lint: fix issues with go 1.18
Browse files Browse the repository at this point in the history
nolint for strings.Title, we only have ASCII strings
and want to capitalize only the first character so no
need to worry about unicode

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
  • Loading branch information
crazy-max committed Mar 22, 2022
1 parent 4a69199 commit b1d03f7
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion frontend/dockerfile/instructions/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ func errExactlyOneArgument(command string) error {
}

func errNoDestinationArgument(command string) error {
return errors.Errorf("%s requires at least two arguments, but only one was provided. Destination could not be determined.", command)
return errors.Errorf("%s requires at least two arguments, but only one was provided. Destination could not be determined", command)
}

func errBadHeredoc(command string, option string) error {
Expand Down
1 change: 1 addition & 0 deletions hack/dockerfiles/lint.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# syntax=docker/dockerfile-upstream:master

FROM golang:1.18-alpine
ENV GOFLAGS="-buildvcs=false"
RUN apk add --no-cache gcc musl-dev yamllint
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.45.0
WORKDIR /go/src/github.com/moby/buildkit
Expand Down
2 changes: 1 addition & 1 deletion solver/testutil/cachestorage_testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ func testWalkIDsByResult(t *testing.T, st solver.CacheKeyStorage) {
func getFunctionName(i interface{}) string {
fullname := runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
dot := strings.LastIndex(fullname, ".") + 1
return strings.Title(fullname[dot:])
return strings.Title(fullname[dot:]) //nolint:staticcheck
}

func rootKey(dgst digest.Digest, output solver.Index) digest.Digest {
Expand Down
4 changes: 2 additions & 2 deletions util/resolver/retryhandler/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func retryError(err error) bool {
if errors.Is(err, io.EOF) || errors.Is(err, syscall.ECONNRESET) || errors.Is(err, syscall.EPIPE) || errors.Is(err, net.ErrClosed) {
return true
}
// catches TLS timeout or other network-related temporary errors
if ne, ok := errors.Cause(err).(net.Error); ok && ne.Temporary() {
// catches TLS timeout
if ne, ok := errors.Cause(err).(net.Error); ok && ne.Timeout() {
return true
}
// https://github.com/containerd/containerd/pull/4724
Expand Down
2 changes: 1 addition & 1 deletion util/testutil/integration/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func Run(t *testing.T, testCases []Test, opt ...TestOpt) {
func getFunctionName(i interface{}) string {
fullname := runtime.FuncForPC(reflect.ValueOf(i).Pointer()).Name()
dot := strings.LastIndex(fullname, ".") + 1
return strings.Title(fullname[dot:])
return strings.Title(fullname[dot:]) //nolint:staticcheck
}

var localImageCache map[string]map[string]struct{}
Expand Down

0 comments on commit b1d03f7

Please sign in to comment.