Skip to content

Commit

Permalink
ci: disable golangci-lint pkg cache temporarily
Browse files Browse the repository at this point in the history
See golangci/golangci-lint-action#135

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
  • Loading branch information
leodido committed Mar 21, 2024
1 parent fd9a09f commit 5e13749
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 21 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/lint.yml
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: actions/setup-go@v5
with:
go-version: "1.21"
cache: false
check-latest: true

- name: Verify the dependencies
run: |
Expand All @@ -42,6 +42,9 @@ jobs:
- name: Lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.54
version: v1.57.1
args: --timeout 20m0s --verbose --out-${IGNORE_FUTURE_WARNINGS}format tab
only-new-issues: true # Show only new issues on pull requests
# Disable caching as a workaround for https://github.com/golangci/golangci-lint-action/issues/135.
# The line can be removed once the golangci-lint issue is resolved.
skip-pkg-cache: true
2 changes: 1 addition & 1 deletion cmd/in/in.go
Expand Up @@ -95,7 +95,7 @@ The verdicts it returns are listed by the name of each package and its specified
}
// Fallback to reading the package-lock.json in the target directory
if packageLockJSONErr != nil || !inOpts.GenerateLock {
packageLockJSON, packageLockJSONErr = npm.GetPackageLockJsonFromDir(targetDir)
packageLockJSON, packageLockJSONErr = npm.GetPackageLockJSONFromDir(targetDir)
}
if packageLockJSONErr != nil {
return packageLockJSONErr
Expand Down
4 changes: 2 additions & 2 deletions cmd/root/root.go
Expand Up @@ -75,7 +75,7 @@ func New(ctx context.Context) (*Command, error) {
Annotations: map[string]string{
"source": project.GetSourceURL(filename),
},
PersistentPreRunE: func(c *cobra.Command, args []string) error {
PersistentPreRunE: func(c *cobra.Command, _ []string) error {
// Do not check for the config file if the command is not available (eg., help) or not core (eg., version)
withConfigFile := false
c, _, err := c.Find(os.Args[1:])
Expand Down Expand Up @@ -240,7 +240,7 @@ func New(ctx context.Context) (*Command, error) {

return nil
},
PersistentPostRunE: func(c *cobra.Command, args []string) error {
PersistentPostRunE: func(c *cobra.Command, _ []string) error {
contextCancel, ok := c.Context().Value(pkgcontext.ContextCancelFuncKey).(context.CancelFunc)
if !ok {
return fmt.Errorf("couldn't obtain configuration options")
Expand Down
2 changes: 1 addition & 1 deletion cmd/version/version.go
Expand Up @@ -39,7 +39,7 @@ func New(ctx context.Context) (*cobra.Command, error) {
Annotations: map[string]string{
"source": project.GetSourceURL(filename),
},
RunE: func(c *cobra.Command, args []string) error {
RunE: func(c *cobra.Command, _ []string) error {
ctx = c.Context()

// Obtain the local options from the context
Expand Down
4 changes: 2 additions & 2 deletions make/docs/main.go
Expand Up @@ -46,7 +46,7 @@ func getManpages(ctx context.Context) *cobra.Command {
SilenceUsage: true,
DisableFlagsInUseLine: true,
Short: "Generate lstn manpages.",
RunE: func(c *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
rootFlagValues, ok := ctx.Value(rootFlagsKey).(*rootFlags)
if !ok {
return fmt.Errorf("couldn't obtain the flag values from the context")
Expand All @@ -68,7 +68,7 @@ func newRoot(ctx context.Context) error {
SilenceUsage: true,
Short: "Generate lstn documentation.",
Args: cobra.ExactArgs(1),
PersistentPreRunE: func(c *cobra.Command, args []string) error {
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
// Eventually validate rootF struct

return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/flags/base_test.go
Expand Up @@ -103,7 +103,7 @@ func (suite *FlagsBaseSuite) TestValidate() {
}

for _, tc := range cases {
suite.T().Run(tc.desc, func(t *testing.T) {
suite.T().Run(tc.desc, func(_ *testing.T) {
actual := Validate(tc.o)
assert.Equal(suite.T(), len(tc.expectedStr), len(actual))
for _, a := range actual {
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/flags/config.go
Expand Up @@ -107,7 +107,7 @@ func (o *ConfigFlags) SetDefaults() {
}
if defaults.CanUpdate(o.Reporting.Types) {
// Create the enum flag value for --reporter
enumValues := goneric.MapToSlice(func(t cmd.ReportType, v []string) string {
enumValues := goneric.MapToSlice(func(_ cmd.ReportType, v []string) string {
return v[0]
}, cmd.ReporterTypeIDs)
sort.Strings(enumValues)
Expand Down
6 changes: 3 additions & 3 deletions pkg/cmd/flags/json_test.go
Expand Up @@ -45,21 +45,21 @@ func (suite *FlagsJSONSuite) TestQuery() {
}

func (suite *FlagsJSONSuite) TestOutput() {
suite.T().Run("Failure", func(t *testing.T) {
suite.T().Run("Failure", func(_ *testing.T) {
i := &JSONFlags{JSON: false, JQ: "."}
input := bytes.NewReader([]byte("{\"key\":\"value\"}"))
var output bytes.Buffer
assert.EqualError(suite.T(), i.GetOutput(context.Background(), input, &output), "cannot output JSON")
})
suite.T().Run("Success", func(t *testing.T) {
t.Run("QueryGetAll", func(t *testing.T) {
t.Run("QueryGetAll", func(_ *testing.T) {
i := &JSONFlags{JSON: true, JQ: "."}
input := bytes.NewReader([]byte("{\"key\":\"value\"}"))
var output bytes.Buffer
assert.NoError(suite.T(), i.GetOutput(context.Background(), input, &output))
assert.Equal(suite.T(), "{\"key\":\"value\"}\n", output.String())
})
t.Run("QueryGetValue", func(t *testing.T) {
t.Run("QueryGetValue", func(_ *testing.T) {
i := &JSONFlags{JSON: true, JQ: ".key"}
input := bytes.NewReader([]byte("{\"key\":\"value\"}"))
var output bytes.Buffer
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/help/config.go
Expand Up @@ -27,7 +27,7 @@ import (
)

func configHelpTopicFunc() TopicFunc {
return func(c *cobra.Command, args []string) {
return func(c *cobra.Command, _ []string) {
b := bytes.NewBufferString("# lstn configuration file\n\n")
fmt.Fprintf(b, "%s\n\n", "The `lstn` CLI looks for a configuration file .lstn.yaml in your `$HOME` directory when it starts.")
fmt.Fprintf(b, "%s\n", "In this file you can set the values for the global `lstn` configurations.")
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/help/environment.go
Expand Up @@ -26,7 +26,7 @@ import (
)

func envHelpTopicFunc() TopicFunc {
return func(c *cobra.Command, args []string) {
return func(c *cobra.Command, _ []string) {
b := bytes.NewBufferString("# lstn environment variables\n\n")
fmt.Fprintf(b, "%s\n\n", "The environment variables override any corresponding configuration setting.")
fmt.Fprintf(b, "%s\n\n", "But flags override them.")
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/help/manual.go
Expand Up @@ -91,7 +91,7 @@ func cReference(w io.Writer, c *cobra.Command, depth int) {
}

func manualHelpTopicFunc() TopicFunc {
return func(c *cobra.Command, args []string) {
return func(c *cobra.Command, _ []string) {
b := bytes.NewBufferString("# lstn cheatsheet\n\n")

// NOTE > Assuming c.Parent() is the root one
Expand Down
2 changes: 1 addition & 1 deletion pkg/cmd/help/reporters.go
Expand Up @@ -24,7 +24,7 @@ import (
)

func reportersHelpTopicFunc() TopicFunc {
return func(c *cobra.Command, args []string) {
return func(c *cobra.Command, _ []string) {
b := bytes.NewBufferString("# lstn reporters\n\n")

for _, reportType := range cmd.AllReportTypes {
Expand Down
2 changes: 1 addition & 1 deletion pkg/listen/types_test.go
Expand Up @@ -540,7 +540,7 @@ func (suite *TypesSuite) TestResponseMarshalJSON() {

for _, tc := range cases {
r := new(Response)
t.Run(tc.desc, func(t *testing.T) {
t.Run(tc.desc, func(_ *testing.T) {
dec := json.NewDecoder(tc.reader)
suite.NoError(dec.Decode(r))
suite.Equal(*r, tc.expected)
Expand Down
4 changes: 2 additions & 2 deletions pkg/npm/types.go
Expand Up @@ -202,8 +202,8 @@ func NewPackageLockJSONFromBytes(b []byte) (PackageLockJSON, error) {
return ret, nil
}

// GetPackageLockJsonFromDir creates a PackageLockJSON instance from the existing package-lock.json in dir, if any.
func GetPackageLockJsonFromDir(dir string) (PackageLockJSON, error) {
// GetPackageLockJSONFromDir creates a PackageLockJSON instance from the existing package-lock.json in dir, if any.
func GetPackageLockJSONFromDir(dir string) (PackageLockJSON, error) {
reader, err := read(dir, "package-lock.json")
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion pkg/transform/transform.go
Expand Up @@ -33,7 +33,7 @@ func init() {
Singleton = modifiers.New()
Singleton.SetTagName("transform")

Singleton.Register("unique", func(ctx context.Context, fl mold.FieldLevel) error {
Singleton.Register("unique", func(_ context.Context, fl mold.FieldLevel) error {
if fl.Field().Kind() == reflect.Slice {
unique := fl.Field().Interface()
switch fl.Field().Type().Elem().String() {
Expand Down

0 comments on commit 5e13749

Please sign in to comment.