Skip to content

Commit

Permalink
Bump golangci-lint to v1.43.0
Browse files Browse the repository at this point in the history
Signed-off-by: Anthony Emengo <aemengo@vmware.com>
  • Loading branch information
Anthony Emengo committed Dec 6, 2021
1 parent 45cbf68 commit 32bafa1
Show file tree
Hide file tree
Showing 11 changed files with 886 additions and 291 deletions.
2 changes: 1 addition & 1 deletion internal/build/container_ops.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func findMount(info types.ContainerJSON, dst string) (types.MountPoint, error) {
return types.MountPoint{}, fmt.Errorf("no matching mount found for %s", dst)
}

//WriteProjectMetadata
// WriteProjectMetadata
func WriteProjectMetadata(p string, metadata platform.ProjectMetadata, os string) ContainerOperation {
return func(ctrClient client.CommonAPIClient, ctx context.Context, containerID string, stdout, stderr io.Writer) error {
buf := &bytes.Buffer{}
Expand Down
6 changes: 5 additions & 1 deletion internal/build/phase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ func CreateFakeLifecycleExecution(logger logging.Logger, docker client.CommonAPI
// where PORT is picked automatically and returned via outPort parameter
func forwardUnix2TCP(ctx context.Context, t *testing.T, outPort chan<- int) {
wg := sync.WaitGroup{}
errChan := make(chan error, 1)

forwardCon := func(tcpCon net.Conn) {
defer wg.Done()
Expand All @@ -555,7 +556,8 @@ func forwardUnix2TCP(ctx context.Context, t *testing.T, outPort chan<- int) {

unixCon, err := net.Dial("unix", "/var/run/docker.sock")
if err != nil {
t.Fatal(err)
errChan <- err
return
}
defer unixCon.Close()
go func() {
Expand All @@ -581,6 +583,8 @@ func forwardUnix2TCP(ctx context.Context, t *testing.T, outPort chan<- int) {
select {
case <-ctx.Done():
goto out
case err = <-errChan:
t.Fatal(err)
default:
c, err := listener.Accept()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func AddHelpFlag(cmd *cobra.Command, commandName string) {
}

func CreateCancellableContext() context.Context {
signals := make(chan os.Signal)
signals := make(chan os.Signal, 1)
signal.Notify(signals, syscall.SIGINT, syscall.SIGTERM)
ctx, cancel := context.WithCancel(context.Background())

Expand Down
2 changes: 1 addition & 1 deletion internal/registry/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func testGit(t *testing.T, when spec.G, it spec.S) {
registryFixture string
outBuf bytes.Buffer
logger logging.Logger
username string = "supra08"
username = "supra08"
)

it.Before(func() {
Expand Down
2 changes: 1 addition & 1 deletion internal/term/term_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func testTerm(t *testing.T, when spec.G, it spec.S) {
r, _, _ := os.Pipe()
fd, isTerm := term.IsTerminal(r)
h.AssertFalse(t, isTerm)
h.AssertNotEq(t, fd, term.InvalidFileDescriptor) //The mock writer is a pipe, and therefore has a file descriptor
h.AssertNotEq(t, fd, term.InvalidFileDescriptor) // The mock writer is a pipe, and therefore has a file descriptor
})

it("returns InvalidFileDescriptor if passed a normal Writer", func() {
Expand Down
10 changes: 5 additions & 5 deletions internal/termui/termui_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func testTermui(t *testing.T, when spec.G, it spec.S) {
fakeDockerStdWriter.WriteStdoutln(`1 of 2 buildpacks participating`)
fakeDockerStdWriter.WriteStdoutln(`some/buildpack-1 0.0.1`)

//move to next screen
// move to next screen
fakeDockerStdWriter.WriteStdoutln(`===> BUILDING`)
h.Eventually(t, func() bool {
return strings.Contains(detectPage.textView.GetText(true), "Detected!")
Expand Down Expand Up @@ -122,7 +122,7 @@ func testTermui(t *testing.T, when spec.G, it spec.S) {
return strings.Contains(dashboardPage.logsView.GetText(true), "some-build-logs")
}, eventuallyInterval, eventuallyDuration)

//extract /layers from build and provide to termui
// extract /layers from build and provide to termui
f, err := os.Open("./testdata/fake-layers.tar")
h.AssertNil(t, err)
h.AssertNil(t, s.ReadLayers(f))
Expand All @@ -141,7 +141,7 @@ func testTermui(t *testing.T, when spec.G, it spec.S) {
h.AssertEq(t, bpChildren2[0].GetChildren()[0].GetText(), "some-file-2.txt")
h.AssertFalse(t, bpChildren2[0].GetChildren()[0].GetReference().(*tar.Header).FileInfo().IsDir())

//finish build
// finish build
fakeBodyChan <- dcontainer.ContainerWaitOKBody{StatusCode: 0}
w.Close()
time.Sleep(500 * time.Millisecond)
Expand Down Expand Up @@ -205,7 +205,7 @@ func testTermui(t *testing.T, when spec.G, it spec.S) {
return strings.Contains(currentPage.textView.GetText(true), "Detecting")
}, eventuallyInterval, eventuallyDuration)

//move to next screen
// move to next screen
s.Info(`===> BUILDING`)
h.Eventually(t, func() bool {
return strings.Contains(currentPage.textView.GetText(true), "Detected!")
Expand All @@ -225,7 +225,7 @@ func testTermui(t *testing.T, when spec.G, it spec.S) {
return strings.Contains(dashboardPage.logsView.GetText(true), "some-build-logs")
}, eventuallyInterval, eventuallyDuration)

//finish build
// finish build
fakeBodyChan <- dcontainer.ContainerWaitOKBody{StatusCode: 1}
w.Close()
time.Sleep(500 * time.Millisecond)
Expand Down
2 changes: 1 addition & 1 deletion pkg/buildpack/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ type DownloadOptions struct {
// The OS of the builder image
ImageOS string

// Deprecated, the older alternative to buildpack URI
// Deprecated: the older alternative to buildpack URI
ImageName string

Daemon bool
Expand Down
7 changes: 3 additions & 4 deletions pkg/client/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,9 @@ func (c *Client) Build(ctx context.Context, opts BuildOptions) error {
}
defer c.docker.ImageRemove(context.Background(), ephemeralBuilder.Name(), types.ImageRemoveOptions{Force: true})

builderPlatformAPIs := append(
ephemeralBuilder.LifecycleDescriptor().APIs.Platform.Deprecated,
ephemeralBuilder.LifecycleDescriptor().APIs.Platform.Supported...,
)
var builderPlatformAPIs builder.APISet
builderPlatformAPIs = append(builderPlatformAPIs, ephemeralBuilder.LifecycleDescriptor().APIs.Platform.Deprecated...)
builderPlatformAPIs = append(builderPlatformAPIs, ephemeralBuilder.LifecycleDescriptor().APIs.Platform.Supported...)

if !supportsPlatformAPI(builderPlatformAPIs) {
c.logger.Debugf("pack %s supports Platform API(s): %s", c.version, strings.Join(build.SupportedPlatformAPIVersions.AsStrings(), ", "))
Expand Down
6 changes: 5 additions & 1 deletion pkg/client/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ func contains(slc []string, v string) bool {
}

func getBestRunMirror(registry string, runImage string, mirrors []string, preferredMirrors []string) string {
runImageList := append(preferredMirrors, append([]string{runImage}, mirrors...)...)
var runImageList []string
runImageList = append(runImageList, preferredMirrors...)
runImageList = append(runImageList, runImage)
runImageList = append(runImageList, mirrors...)

for _, img := range runImageList {
ref, err := name.ParseReference(img, name.WeakValidation)
if err != nil {
Expand Down
108 changes: 4 additions & 104 deletions tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,109 +3,9 @@ module github.com/buildpacks/pack/tools
go 1.17

require (
github.com/golang/mock v1.4.1
github.com/golangci/golangci-lint v1.30.0
golang.org/x/tools v0.0.0-20200724022722-7017fd6b1305
github.com/golang/mock v1.6.0
github.com/golangci/golangci-lint v1.43.0
golang.org/x/tools v0.1.7
)

require (
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/Djarvur/go-err113 v0.0.0-20200511133814-5174e21577d5 // indirect
github.com/Masterminds/semver v1.5.0 // indirect
github.com/OpenPeeDeeP/depguard v1.0.1 // indirect
github.com/bombsimon/wsl/v3 v3.1.0 // indirect
github.com/daixiang0/gci v0.0.0-20200727065011-66f1df783cb2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/denis-tingajkin/go-header v0.3.1 // indirect
github.com/fatih/color v1.9.0 // indirect
github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-critic/go-critic v0.5.0 // indirect
github.com/go-toolsmith/astcast v1.0.0 // indirect
github.com/go-toolsmith/astcopy v1.0.0 // indirect
github.com/go-toolsmith/astequal v1.0.0 // indirect
github.com/go-toolsmith/astfmt v1.0.0 // indirect
github.com/go-toolsmith/astp v1.0.0 // indirect
github.com/go-toolsmith/strparse v1.0.0 // indirect
github.com/go-toolsmith/typep v1.0.2 // indirect
github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gofrs/flock v0.7.1 // indirect
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect
github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect
github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6 // indirect
github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613 // indirect
github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3 // indirect
github.com/golangci/gocyclo v0.0.0-20180528144436-0a533e8fa43d // indirect
github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a // indirect
github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc // indirect
github.com/golangci/lint-1 v0.0.0-20191013205115-297bf364a8e0 // indirect
github.com/golangci/maligned v0.0.0-20180506175553-b1d89398deca // indirect
github.com/golangci/misspell v0.0.0-20180809174111-950f5d19e770 // indirect
github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 // indirect
github.com/golangci/revgrep v0.0.0-20180812185044-276a5c0a1039 // indirect
github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4 // indirect
github.com/google/go-cmp v0.5.0 // indirect
github.com/gostaticanalysis/analysisutil v0.0.3 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jingyugao/rowserrcheck v0.0.0-20191204022205-72ab7603b68a // indirect
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af // indirect
github.com/kisielk/gotool v1.0.0 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.3 // indirect
github.com/kyoh86/exportloopref v0.1.7 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/maratori/testpackage v1.0.1 // indirect
github.com/matoous/godox v0.0.0-20190911065817-5d6d842e92eb // indirect
github.com/mattn/go-colorable v0.1.7 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/nakabonne/nestif v0.3.0 // indirect
github.com/nbutton23/zxcvbn-go v0.0.0-20180912185939-ae427f1e4c1d // indirect
github.com/nishanths/exhaustive v0.0.0-20200708172631-8866003e3856 // indirect
github.com/pelletier/go-toml v1.6.0 // indirect
github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/quasilyte/go-ruleguard v0.1.2-0.20200318202121-b00d7a75d3d8 // indirect
github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95 // indirect
github.com/ryancurrah/gomodguard v1.1.0 // indirect
github.com/ryanrolds/sqlclosecheck v0.3.0 // indirect
github.com/securego/gosec/v2 v2.4.0 // indirect
github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect
github.com/shurcooL/go v0.0.0-20190704215121-7189cc372560 // indirect
github.com/sirupsen/logrus v1.6.0 // indirect
github.com/sonatard/noctx v0.0.1 // indirect
github.com/sourcegraph/go-diff v0.5.3 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/cobra v1.0.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.7.0 // indirect
github.com/ssgreg/nlreturn/v2 v2.0.1 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.6.1 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2 // indirect
github.com/tetafro/godot v0.4.8 // indirect
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e // indirect
github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa // indirect
github.com/ultraware/funlen v0.0.2 // indirect
github.com/ultraware/whitespace v0.0.4 // indirect
github.com/uudashr/gocognit v1.0.1 // indirect
golang.org/x/mod v0.3.0 // indirect
golang.org/x/sys v0.0.0-20200519105757-fe76b779f299 // indirect
golang.org/x/text v0.3.2 // indirect
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 // indirect
gopkg.in/ini.v1 v1.52.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
honnef.co/go/tools v0.0.1-2020.1.4 // indirect
mvdan.cc/gofumpt v0.0.0-20200709182408-4fd085cb6d5f // indirect
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed // indirect
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b // indirect
mvdan.cc/unparam v0.0.0-20191111180625-960b1ec0f2c2 // indirect
sourcegraph.com/sqs/pbtypes v1.0.0 // indirect
)
require github.com/stretchr/objx v0.2.0 // indirect
Loading

0 comments on commit 32bafa1

Please sign in to comment.