Skip to content

Commit dfc0273

Browse files
authored
Merge pull request tinkerbell#14 from tstromberg/gofumpt2
Enable gofumpt and gosec
2 parents aadfbe2 + d5733a0 commit dfc0273

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

.golangci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ linters-settings:
1818
min-occurrences: 5
1919
ignore-tests: true
2020

21+
gosec:
22+
excludes:
23+
- G107 # Potential HTTP request made with variable url
24+
- G204 # Subprocess launched with function call as argument or cmd arguments
25+
- G404 # Use of weak random number generator (math/rand instead of crypto/rand
26+
2127
errorlint:
2228
# these are still common in Go: for instance, exit errors.
2329
asserts: false
@@ -108,6 +114,8 @@ linters:
108114
- gocritic
109115
- godot
110116
- gofmt
117+
- gofumpt
118+
- gosec
111119
- goheader
112120
- goimports
113121
- goprintffuncname
@@ -158,8 +166,6 @@ linters:
158166
# - maligned
159167
# - prealloc "For most programs usage of prealloc will be a premature optimization."
160168
# Disabled linters due to bad error messages or bugs
161-
# - gofumpt
162-
# - gosec
163169
# - tagliatelle
164170

165171
issues:

lint-install.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ func updateMakefile(root string, cfg Config, dryRun bool) (string, error) {
128128
edits := myers.ComputeEdits("Makefile", string(existing), string(proposed))
129129
change := gotextdiff.ToUnified(filepath.Base(dest), filepath.Base(dest), string(existing), edits)
130130
if !dryRun {
131-
if err := os.WriteFile(dest, proposed, 0755); err != nil {
131+
if err := os.WriteFile(dest, proposed, 0o600); err != nil {
132132
return "", err
133133
}
134134
}
@@ -154,7 +154,7 @@ func updateGoLint(root string, dryRun bool) (string, error) {
154154
change := gotextdiff.ToUnified(filepath.Base(dest), filepath.Base(dest), string(existing), edits)
155155

156156
if !dryRun {
157-
if err := os.WriteFile(dest, goLintConfig, 0755); err != nil {
157+
if err := os.WriteFile(dest, goLintConfig, 0o600); err != nil {
158158
return "", err
159159
}
160160
}
@@ -176,7 +176,6 @@ func goLintCmd(root string, level string) string {
176176
},
177177
Unsorted: true,
178178
})
179-
180179
if err != nil {
181180
klog.Errorf("unable to find go.mod files: %v", err)
182181
}

0 commit comments

Comments
 (0)