mirror of
https://github.com/ossf/scorecard.git
synced 2024-09-11 08:55:27 +03:00
Fix lint issues: wrapcheck linter
Bumping version of golangci-lint because it has a fix for a false positive we were encountering.
This commit is contained in:
parent
53262f0368
commit
9214d71c8f
2
Makefile
2
Makefile
@ -45,7 +45,7 @@ test: ## Runs unit test
|
||||
go test -covermode atomic `go list ./... | grep -v e2e`
|
||||
|
||||
golangci-lint:
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.39.0
|
||||
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.40.0
|
||||
|
||||
lint: golangci-lint ## Runs golangci-lint linter
|
||||
golangci-lint run -n
|
||||
|
@ -37,7 +37,10 @@ type RepoResult struct {
|
||||
func (r *RepoResult) AsJSON(showDetails bool, writer io.Writer) error {
|
||||
encoder := json.NewEncoder(writer)
|
||||
if showDetails {
|
||||
return encoder.Encode(r)
|
||||
if err := encoder.Encode(r); err != nil {
|
||||
return fmt.Errorf("error encoding repo result as detailed JSON: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
out := RepoResult{
|
||||
Repo: r.Repo,
|
||||
@ -52,7 +55,10 @@ func (r *RepoResult) AsJSON(showDetails bool, writer io.Writer) error {
|
||||
}
|
||||
out.Checks = append(out.Checks, tmpResult)
|
||||
}
|
||||
return encoder.Encode(out)
|
||||
if err := encoder.Encode(out); err != nil {
|
||||
return fmt.Errorf("error encoding repo result as JSON: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *RepoResult) AsCSV(showDetails bool, writer io.Writer) error {
|
||||
@ -70,10 +76,13 @@ func (r *RepoResult) AsCSV(showDetails bool, writer io.Writer) error {
|
||||
}
|
||||
fmt.Fprintf(writer, "%s\n", strings.Join(columns, ","))
|
||||
if err := w.Write(record); err != nil {
|
||||
return err
|
||||
return fmt.Errorf("error writing repo result as CSV: %w", err)
|
||||
}
|
||||
w.Flush()
|
||||
return w.Error()
|
||||
if err := w.Error(); err != nil {
|
||||
return fmt.Errorf("error flushing repo result as CSV: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *RepoResult) AsString(showDetails bool, writer io.Writer) error {
|
||||
|
@ -52,7 +52,7 @@ func (r *RepoURL) Set(s string) error {
|
||||
|
||||
u, e := url.Parse(s)
|
||||
if e != nil {
|
||||
return e
|
||||
return fmt.Errorf("error parsing repo URL: %w", e)
|
||||
}
|
||||
|
||||
const splitLen = 2
|
||||
|
Loading…
Reference in New Issue
Block a user