Skip to content

Commit

Permalink
bump lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani committed Aug 28, 2024
1 parent ca25695 commit 5f029fa
Show file tree
Hide file tree
Showing 20 changed files with 24 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:

jobs:
lint:
name: "lint"
name: "govet | govulncheck | lint"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -35,4 +35,4 @@ jobs:
env:
GOTOOLCHAIN: local+path
GOSUMDB: off
run: make lint-ci
run: make ci
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ linters:
enable:
- bodyclose
- decorder
#- depguard
- depguard
- dogsled
- dupword
- errchkjson
Expand All @@ -25,7 +25,6 @@ linters:
- misspell
- nakedret
- nolintlint
- exportloopref
- staticcheck
- reassign
- stylecheck
Expand Down
6 changes: 3 additions & 3 deletions appregistry/registry/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand All @@ -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:]
Expand Down
2 changes: 1 addition & 1 deletion examples/chain-info/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module chain-info
module github.com/ignite/apps/examples/chain-info

go 1.21.1

Expand Down
2 changes: 1 addition & 1 deletion examples/chain-info/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
2 changes: 1 addition & 1 deletion examples/flags/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module flags
module github.com/ignite/apps/examples/flags

go 1.21.1

Expand Down
2 changes: 1 addition & 1 deletion examples/flags/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
2 changes: 1 addition & 1 deletion examples/health-monitor/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module health-monitor
module github.com/ignite/apps/examples/health-monitor

go 1.21.1

Expand Down
2 changes: 1 addition & 1 deletion examples/health-monitor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
2 changes: 1 addition & 1 deletion examples/hello-world/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module hello-world
module github.com/ignite/apps/examples/hello-world

go 1.21.1

Expand Down
2 changes: 1 addition & 1 deletion examples/hello-world/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
2 changes: 1 addition & 1 deletion examples/hooks/go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module hooks
module github.com/ignite/apps/examples/hooks

go 1.21.1

Expand Down
2 changes: 1 addition & 1 deletion examples/hooks/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down
2 changes: 1 addition & 1 deletion rollkit/cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion rollkit/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions rollkit/template/rollkit.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package template

import (
"errors"
"path/filepath"
"strings"

"github.com/gobuffalo/genny/v2"
"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"
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion spaceship/cmd/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
16 changes: 0 additions & 16 deletions spaceship/pkg/ssh/ssh.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
// 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 (
"context"
"fmt"
"net/url"
"os"
"os/exec"
"path/filepath"
"strings"

Expand Down Expand Up @@ -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...)
Expand Down
4 changes: 2 additions & 2 deletions spaceship/pkg/ssh/upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion spaceship/pkg/tarball/tarball.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f029fa

Please sign in to comment.