diff --git a/.github/workflows/test-lint.yml b/.github/workflows/test-lint.yml index 35d119f5..24541a9c 100644 --- a/.github/workflows/test-lint.yml +++ b/.github/workflows/test-lint.yml @@ -13,7 +13,7 @@ concurrency: jobs: lint: - name: "lint" + name: "govet | govulncheck | lint" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -35,4 +35,4 @@ jobs: env: GOTOOLCHAIN: local+path GOSUMDB: off - run: make lint-ci + run: make ci diff --git a/.golangci.yml b/.golangci.yml index 9ee936dc..8df9dd5c 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,7 +7,7 @@ linters: enable: - bodyclose - decorder - #- depguard + - depguard - dogsled - dupword - errchkjson @@ -25,7 +25,6 @@ linters: - misspell - nakedret - nolintlint - - exportloopref - staticcheck - reassign - stylecheck diff --git a/appregistry/registry/details.go b/appregistry/registry/details.go index b3bb2200..b7682c02 100644 --- a/appregistry/registry/details.go +++ b/appregistry/registry/details.go @@ -61,7 +61,7 @@ func (r Querier) GetAppDetails(ctx context.Context, appName string) (*AppReposit return nil, errors.Errorf("app %s not found", appName) } - repoOwner, repoName, err := validateRepoUrl(appEntry.RepositoryURL) + repoOwner, repoName, err := validateRepoURL(appEntry.RepositoryURL) if err != nil { return nil, err } @@ -138,7 +138,7 @@ func (r Querier) getAppsConfig(ctx context.Context, repo *github.Repository) (*p return &conf, nil } -func validateRepoUrl(repoURL string) (owner, name string, err error) { +func validateRepoURL(repoURL string) (owner, name string, err error) { matches := githubRepoPattern.FindStringSubmatch(repoURL) if len(matches) < 4 { return "", "", errors.Errorf("invalid repo URL: %s", repoURL) @@ -157,7 +157,7 @@ func findCLIVersion(modFile *modfile.File) string { return "" } -// stripHttpOrHttpsFromUrl strips http or https scheme from a URL +// stripHTTPOrHTTPSFromURL strips http or https scheme from a URL. func stripHTTPOrHTTPSFromURL(url string) string { if url[:8] == "https://" { url = url[8:] diff --git a/examples/chain-info/go.mod b/examples/chain-info/go.mod index 80561b08..1776c00e 100644 --- a/examples/chain-info/go.mod +++ b/examples/chain-info/go.mod @@ -1,4 +1,4 @@ -module chain-info +module github.com/ignite/apps/examples/chain-info go 1.21.1 diff --git a/examples/chain-info/main.go b/examples/chain-info/main.go index 0f10150a..8e1392be 100644 --- a/examples/chain-info/main.go +++ b/examples/chain-info/main.go @@ -8,7 +8,7 @@ import ( "github.com/ignite/cli/v28/ignite/services/chain" "github.com/ignite/cli/v28/ignite/services/plugin" - "chain-info/cmd" + "github.com/ignite/apps/examples/chain-info/cmd" ) type app struct{} diff --git a/examples/flags/go.mod b/examples/flags/go.mod index cf7ef8db..aea93f5b 100644 --- a/examples/flags/go.mod +++ b/examples/flags/go.mod @@ -1,4 +1,4 @@ -module flags +module github.com/ignite/apps/examples/flags go 1.21.1 diff --git a/examples/flags/main.go b/examples/flags/main.go index 800d0875..53760b88 100644 --- a/examples/flags/main.go +++ b/examples/flags/main.go @@ -7,7 +7,7 @@ import ( "github.com/ignite/cli/v28/ignite/pkg/errors" "github.com/ignite/cli/v28/ignite/services/plugin" - "flags/cmd" + "github.com/ignite/apps/examples/flags/cmd" ) type app struct{} diff --git a/examples/health-monitor/go.mod b/examples/health-monitor/go.mod index 807878b0..451e9fee 100644 --- a/examples/health-monitor/go.mod +++ b/examples/health-monitor/go.mod @@ -1,4 +1,4 @@ -module health-monitor +module github.com/ignite/apps/examples/health-monitor go 1.21.1 diff --git a/examples/health-monitor/main.go b/examples/health-monitor/main.go index 12a8e335..439b80d8 100644 --- a/examples/health-monitor/main.go +++ b/examples/health-monitor/main.go @@ -7,7 +7,7 @@ import ( "github.com/ignite/cli/v28/ignite/pkg/errors" "github.com/ignite/cli/v28/ignite/services/plugin" - "health-monitor/cmd" + "github.com/ignite/apps/examples/health-monitor/cmd" ) type app struct{} diff --git a/examples/hello-world/go.mod b/examples/hello-world/go.mod index 104aab76..5aa3effc 100644 --- a/examples/hello-world/go.mod +++ b/examples/hello-world/go.mod @@ -1,4 +1,4 @@ -module hello-world +module github.com/ignite/apps/examples/hello-world go 1.21.1 diff --git a/examples/hello-world/main.go b/examples/hello-world/main.go index 2dc1dca3..bcb4024b 100644 --- a/examples/hello-world/main.go +++ b/examples/hello-world/main.go @@ -7,7 +7,7 @@ import ( hplugin "github.com/hashicorp/go-plugin" "github.com/ignite/cli/v28/ignite/services/plugin" - "hello-world/cmd" + "github.com/ignite/apps/examples/hello-world/cmd" ) type app struct{} diff --git a/examples/hooks/go.mod b/examples/hooks/go.mod index f094415c..d95b1d19 100644 --- a/examples/hooks/go.mod +++ b/examples/hooks/go.mod @@ -1,4 +1,4 @@ -module hooks +module github.com/ignite/apps/examples/hooks go 1.21.1 diff --git a/examples/hooks/main.go b/examples/hooks/main.go index 1c889290..c4df3b73 100644 --- a/examples/hooks/main.go +++ b/examples/hooks/main.go @@ -7,7 +7,7 @@ import ( hplugin "github.com/hashicorp/go-plugin" "github.com/ignite/cli/v28/ignite/services/plugin" - "hooks/cmd" + "github.com/ignite/apps/examples/hooks/cmd" ) type app struct{} diff --git a/rollkit/cmd/add.go b/rollkit/cmd/add.go index 3c169da7..3b41661a 100644 --- a/rollkit/cmd/add.go +++ b/rollkit/cmd/add.go @@ -57,7 +57,7 @@ func AddHandler(ctx context.Context, cmd *plugin.ExecutedCommand) error { return session.Printf("🎉 RollKit added (`%[1]v`).\n", c.AppPath(), c.Name()) } -// finish finalize the scaffolded code (formating, dependencies) +// finish finalize the scaffolded code (formating, dependencies). func finish(ctx context.Context, session *cliui.Session, path string) error { session.StartSpinner("go mod tidy...") if err := gocmd.ModTidy(ctx, path); err != nil { diff --git a/rollkit/cmd/init.go b/rollkit/cmd/init.go index 62c95279..b91843b1 100644 --- a/rollkit/cmd/init.go +++ b/rollkit/cmd/init.go @@ -16,9 +16,9 @@ import ( configchain "github.com/ignite/cli/v28/ignite/config/chain" "github.com/ignite/cli/v28/ignite/pkg/cliui" "github.com/ignite/cli/v28/ignite/pkg/cliui/colors" + "github.com/ignite/cli/v28/ignite/pkg/errors" "github.com/ignite/cli/v28/ignite/services/chain" "github.com/ignite/cli/v28/ignite/services/plugin" - "github.com/pkg/errors" ) const defaultValPower = 1 diff --git a/rollkit/template/rollkit.go b/rollkit/template/rollkit.go index 0caf8b31..ee134eb2 100644 --- a/rollkit/template/rollkit.go +++ b/rollkit/template/rollkit.go @@ -1,7 +1,6 @@ package template import ( - "errors" "path/filepath" "strings" @@ -9,6 +8,7 @@ import ( "github.com/gobuffalo/plush/v4" "github.com/ignite/cli/v28/ignite/pkg/cosmosver" + "github.com/ignite/cli/v28/ignite/pkg/errors" "github.com/ignite/cli/v28/ignite/pkg/xast" "github.com/ignite/cli/v28/ignite/pkg/xgenny" "github.com/ignite/cli/v28/ignite/services/chain" @@ -32,7 +32,7 @@ func NewRollKitGenerator(chain *chain.Chain) (*genny.Generator, error) { return g, nil } -// commandsModify modifies the application start to use rollkit +// commandsModify modifies the application start to use rollkit. func commandsModify(appPath, binaryName string, version cosmosver.Version) genny.RunFn { return func(r *genny.Runner) error { cmdPath := filepath.Join(appPath, "cmd", binaryName, "cmd/commands.go") diff --git a/spaceship/cmd/ssh.go b/spaceship/cmd/ssh.go index b1676d66..a5418062 100644 --- a/spaceship/cmd/ssh.go +++ b/spaceship/cmd/ssh.go @@ -328,5 +328,5 @@ func ExecuteSSHDeploy(ctx context.Context, cmd *plugin.ExecutedCommand, chain *p } _ = session.Println("") - return session.Println(color.Blue.Sprintf(start)) + return session.Println(color.Blue.Sprint(start)) } diff --git a/spaceship/pkg/ssh/ssh.go b/spaceship/pkg/ssh/ssh.go index 4f140995..70922e53 100644 --- a/spaceship/pkg/ssh/ssh.go +++ b/spaceship/pkg/ssh/ssh.go @@ -1,7 +1,6 @@ // Package ssh provides functionalities for establishing SSH connections // and performing various operations such as file uploads, command execution, // and managing remote environments. - package ssh import ( @@ -9,7 +8,6 @@ import ( "fmt" "net/url" "os" - "os/exec" "path/filepath" "strings" @@ -279,20 +277,6 @@ func (s *SSH) ensureEnvironment() error { return nil } -// ensureLocalBin uploads the specified binary to the remote server's bin directory. -func (s *SSH) ensureLocalBin(name string, progressCallback ProgressCallback) error { - // find ignite binary path - path, err := exec.LookPath(name) - if err != nil { - return err - } - _, err = s.UploadBinary(path, progressCallback) - if err != nil { - return err - } - return nil -} - // RunCommand runs a command on the remote server and returns the output. func (s *SSH) RunCommand(ctx context.Context, name string, args ...string) (string, error) { cmd, err := s.client.CommandContext(ctx, name, args...) diff --git a/spaceship/pkg/ssh/upload.go b/spaceship/pkg/ssh/upload.go index abdbfe0a..646f8ce1 100644 --- a/spaceship/pkg/ssh/upload.go +++ b/spaceship/pkg/ssh/upload.go @@ -56,7 +56,7 @@ func (s *SSH) Upload(ctx context.Context, srcPath, dstPath string, progressCallb return nil, err } - grp, ctx := errgroup.WithContext(ctx) + grp, _ := errgroup.WithContext(ctx) grp.SetLimit(5) uploadedFiles := make([]string, 0) @@ -77,7 +77,7 @@ func (s *SSH) Upload(ctx context.Context, srcPath, dstPath string, progressCallb newPath := filepath.Join(dstPath, rel) grp.Go(func() error { - file, err := s.UploadFile(path, newPath, func(bytesUploaded int64, fileTotalBytes int64) error { + file, err := s.UploadFile(path, newPath, func(bytesUploaded int64, _ int64) error { uploadedBytes += bytesUploaded // Call the progress callback with the total uploaded bytes return progressCallback(uploadedBytes, totalBytes) diff --git a/spaceship/pkg/tarball/tarball.go b/spaceship/pkg/tarball/tarball.go index 58551575..55abdfc2 100644 --- a/spaceship/pkg/tarball/tarball.go +++ b/spaceship/pkg/tarball/tarball.go @@ -30,7 +30,7 @@ func Extract(ctx context.Context, file, output string, fileList ...string) ([]st } extracted := make([]string, 0) - err = format.(archiver.Extractor).Extract(ctx, reader, fileList, func(ctx context.Context, f archiver.File) error { + err = format.(archiver.Extractor).Extract(ctx, reader, fileList, func(_ context.Context, f archiver.File) error { rc, err := f.Open() if err != nil { return err