Skip to content

Commit

Permalink
fix linter errors
Browse files Browse the repository at this point in the history
Signed-off-by: Moritz Wiesinger <[email protected]>
  • Loading branch information
mowies committed Nov 27, 2024
1 parent d8a1dd6 commit eeb45e6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
3 changes: 2 additions & 1 deletion cmd/githubgen/codeowners.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package main

import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
Expand Down Expand Up @@ -176,7 +177,7 @@ func (cg codeownersGenerator) getGithubMembers() (map[string]struct{}, error) {
}
githubToken := os.Getenv("GITHUB_TOKEN")
if githubToken == "" {
return nil, fmt.Errorf("Set the environment variable `GITHUB_TOKEN` to a PAT token to authenticate")
return nil, errors.New("set the environment variable `GITHUB_TOKEN` to a PAT token to authenticate")
}
client := github.NewTokenClient(context.Background(), githubToken)
var allUsers []*github.User
Expand Down
3 changes: 1 addition & 2 deletions cmd/githubgen/distributions.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package main

import (
"fmt"
"os"
"path/filepath"
"sort"
Expand Down Expand Up @@ -53,7 +52,7 @@ func (cg distributionsGenerator) generate(data *githubData) error {
if err != nil {
return nil
}
err = os.WriteFile(filepath.Join("reports", "distributions", fmt.Sprintf("%s.yaml", dist.Name)), b, 0o600)
err = os.WriteFile(filepath.Join("reports", "distributions", dist.Name+".yaml"), b, 0o600)
if err != nil {
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/githubgen/issuetemplates.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (itg issueTemplatesGenerator) generate(data *githubData) error {
return err
}
for _, e := range entries {
templateContents, err := os.ReadFile(filepath.Join(issuesFolder, e.Name()))
templateContents, err := os.ReadFile(filepath.Join(issuesFolder, e.Name())) // nolint: gosec
if err != nil {
return err
}
Expand Down
7 changes: 3 additions & 4 deletions cmd/githubgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package main
import (
"context"
"flag"
"fmt"
"io/fs"
"log"
"os"
Expand Down Expand Up @@ -45,7 +44,7 @@ func main() {
case "distributions":
generators = append(generators, distributionsGenerator{})
default:
panic(fmt.Sprintf("Unknown generator: %s", arg))
panic("Unknown generator: " + arg)
}
}
if len(generators) == 0 {
Expand Down Expand Up @@ -140,7 +139,7 @@ func run(folder string, allowlistFilePath string, generators []generator) error
}
if m.Status.Codeowners == nil {
// TODO to be changed back to fmt.Errorf once codeowners for all components are defined
log.Println(fmt.Sprintf("WARNING: component %q has no codeowners section", key))
log.Printf("WARNING: component %q has no codeowners section", key)
return nil
}
for _, id := range m.Status.Codeowners.Active {
Expand All @@ -164,7 +163,7 @@ func run(folder string, allowlistFilePath string, generators []generator) error
sort.Strings(codeownersList)

var distributions []distributionData
dd, err := os.ReadFile(filepath.Join(folder, "distributions.yaml"))
dd, err := os.ReadFile(filepath.Join(folder, "distributions.yaml")) // nolint: gosec
if err != nil {
return err
}
Expand Down

0 comments on commit eeb45e6

Please sign in to comment.