Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up Makefile, remove outdated tools, setup goio #1113

Merged
merged 4 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,18 @@ all build:
# make verify
verify: build
hack/verify-gofmt.sh
hack/verify-golint.sh
hack/verify-govet.sh
hack/verify-deps.sh
hack/verify-bash-completion.sh
hack/verify-imports.sh
.PHONY: verify

# Install travis dependencies
#
# Example:
# make install-travis
install-travis:
hack/install-tools.sh
.PHONY: install-travis
imports: ## Organize imports in go files using goio. Example: make imports
go run ./vendor/github.com/go-imports-organizer/goio
.PHONY: imports

verify-imports: ## Run import verifications. Example: make verify-imports
hack/verify-imports.sh
.PHONY: verify-imports

# Build and run unit tests
#
Expand Down Expand Up @@ -101,8 +100,3 @@ release: clean
hack/build-release.sh
hack/extract-release.sh
.PHONY: release

# Update dependencies
update-deps:
hack/update-deps.sh
.PHONY: update-deps
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/docker/distribution v2.8.1+incompatible
github.com/docker/docker v23.0.1+incompatible
github.com/docker/go-connections v0.4.0
github.com/go-imports-organizer/goio v1.3.1
github.com/moby/buildkit v0.11.4
github.com/opencontainers/image-spec v1.1.0-rc2
github.com/spf13/cobra v1.6.1
Expand Down Expand Up @@ -63,11 +64,12 @@ require (
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/vbatts/tar-split v0.11.2 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/mod v0.9.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-imports-organizer/goio v1.3.1 h1:q72ax5m+TBu4EbbPQGjEIeGOp7SunTT6bEQXQsKWLMc=
github.com/go-imports-organizer/goio v1.3.1/go.mod h1:2Ca2HiGdeWEra1S9MsLKWdhsf8YNZLm3PtwsFuWM6wM=
github.com/go-ini/ini v1.25.4/go.mod h1:ByCAeIL28uOIIG0E3PJtZPDL8WnHpFKFOtgjp+3Ies8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
Expand Down Expand Up @@ -789,8 +791,8 @@ golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down
28 changes: 28 additions & 0 deletions goio.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# How the Red Hat OpenShift organization (github.com/openshift) organizes their imports
# See https://github.com/go-imports-organizer/goio/blob/main/README.md for more information
excludes:
- matchtype: name
regexp: ^\.git$
- matchtype: name
regexp: ^vendor$
groups:
- description: standard
matchorder: 3
regexp:
- ^[a-zA-Z0-9\/]+$
- description: kubernetes
matchorder: 1
regexp:
- ^k8s\.io
- description: openshift
matchorder: 2
regexp:
- ^github\.com\/openshift
- description: other
matchorder: 4
regexp:
- '[a-zA-Z0-9]+\.[a-zA-Z0-9]+/'
- description: module
matchorder: 0
regexp:
- "%{module}%"
9 changes: 9 additions & 0 deletions hack/tools.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//go:build tools
// +build tools

package hack

// Add tools that scripts depend on here, to ensure they are vendored.
import (
_ "github.com/go-imports-organizer/goio"
)
26 changes: 0 additions & 26 deletions hack/verify-golint.sh

This file was deleted.

33 changes: 0 additions & 33 deletions hack/verify-govet.sh

This file was deleted.

9 changes: 9 additions & 0 deletions hack/verify-imports.sh
coreydaley marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

bad_files=$(go run ./vendor/github.com/go-imports-organizer/goio -l)
if [[ -n "${bad_files}" ]]; then
echo "!!! goio needs to be run on the following files:"
echo "${bad_files}"
echo "Try running 'make imports'"
exit 1
fi
4 changes: 2 additions & 2 deletions pkg/cmd/cli/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"os"
"path/filepath"

log "k8s.io/klog/v2"

"github.com/spf13/cobra"
"github.com/spf13/pflag"

log "k8s.io/klog/v2"

"github.com/openshift/source-to-image/pkg/api"
)

Expand Down
6 changes: 3 additions & 3 deletions pkg/ignore/ignore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ func TestBasicDelKeepMix(t *testing.T) {
/*
Per the docker user guide, with a docker ignore list of:

LICENSE.*
!LICENSE.md
*.md
LICENSE.*
!LICENSE.md
*.md

LICENSE.MD will NOT be kept, as *.md overrides !LICENSE.md
*/
Expand Down
8 changes: 5 additions & 3 deletions pkg/util/timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ func (t *TimeoutError) Error() string {
// case that the execution time of the function exceeded the provided duration.
// The provided function is passed the timer in case it wishes to reset it. If
// so, the following pattern must be used:
// if !timer.Stop() {
// return &TimeoutError{}
// }
//
// if !timer.Stop() {
// return &TimeoutError{}
// }
//
// timer.Reset(timeout)
func TimeoutAfter(t time.Duration, errorMsg string, f func(*time.Timer) error) error {
c := make(chan error, 1)
Expand Down
1 change: 1 addition & 0 deletions test/integration/docker/dockerssl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"testing"

dockerapi "github.com/docker/docker/api"

"github.com/openshift/source-to-image/pkg/api"
"github.com/openshift/source-to-image/pkg/docker"
)
Expand Down
4 changes: 2 additions & 2 deletions test/integration/docker/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ import (
"testing"
"time"

"k8s.io/klog/v2"

dockertypes "github.com/docker/docker/api/types"
dockercontainer "github.com/docker/docker/api/types/container"
dockerapi "github.com/docker/docker/client"
"golang.org/x/net/context"

"k8s.io/klog/v2"

"github.com/openshift/source-to-image/pkg/api"
"github.com/openshift/source-to-image/pkg/build"
"github.com/openshift/source-to-image/pkg/build/strategies"
Expand Down
3 changes: 3 additions & 0 deletions vendor/github.com/go-imports-organizer/goio/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading