forked from golang/glog
-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
golangci-lint v1.52.2 in its default configuration pointed out several issues that are worth fixing: internal/verbosity/verbosity_test.go:26:18: Error return value of `vs.verbosity.Set` is not checked (errcheck) vs.verbosity.Set("2") ^ internal/verbosity/verbosity_test.go:41:16: Error return value of `vs.vmodule.Set` is not checked (errcheck) vs.vmodule.Set("verbosity_test=2") ^ internal/verbosity/verbosity_test.go:84:16: Error return value of `vs.vmodule.Set` is not checked (errcheck) vs.vmodule.Set(pat) ^ internal/verbosity/verbosity.go:291:2: S1017: should replace this if statement with an unconditional strings.TrimSuffix (gosimple) if strings.HasSuffix(file, ".go") { ^ textlogger/options.go:140:19: Error return value of `(flag.Value).Set` is not checked (errcheck) c.Verbosity().Set(strconv.FormatInt(int64(c.co.verbosityDefault), 10)) ^ textlogger/textlogger.go:137:26: Error return value of `l.config.co.output.Write` is not checked (errcheck) l.config.co.output.Write(b.Bytes()) ^ textlogger/textlogger.go:141:26: Error return value of `l.config.co.output.Write` is not checked (errcheck) l.config.co.output.Write(data) ^ ktesting/options.go:163:18: Error return value of `(flag.Value).Set` is not checked (errcheck) c.vstate.V().Set(strconv.FormatInt(int64(c.co.verbosityDefault), 10)) ^ klogr/calldepth-test/call_depth_main_test.go:21:22: Error return value of `flag.CommandLine.Set` is not checked (errcheck) flag.CommandLine.Set("v", "10") ^ klogr/calldepth-test/call_depth_main_test.go:22:22: Error return value of `flag.CommandLine.Set` is not checked (errcheck) flag.CommandLine.Set("skip_headers", "false") ^ klogr/calldepth-test/call_depth_main_test.go:23:22: Error return value of `flag.CommandLine.Set` is not checked (errcheck) flag.CommandLine.Set("logtostderr", "false") ^ klog.go:903:34: Error return value of `(io.Writer).Write` is not checked (errcheck) l.file[severity.InfoLog].Write(data) ^ klog.go:913:20: Error return value of `(io.Writer).Write` is not checked (errcheck) l.file[s].Write(data) ^ klog.go:917:37: Error return value of `(io.Writer).Write` is not checked (errcheck) l.file[severity.FatalLog].Write(data) ^ klog.go:952:12: Error return value of `f.Write` is not checked (errcheck) f.Write(trace) ^ klog.go:1208:13: Error return value of `file.Sync` is not checked (errcheck) file.Sync() // ignore error ^ klog_file.go:113:14: Error return value of `os.Symlink` is not checked (errcheck) os.Symlink(name, symlink) // ignore err ^ klog_test.go:328:23: Error return value of `logging.verbosity.Set` is not checked (errcheck) logging.verbosity.Set("2") ^ klog_test.go:343:21: Error return value of `logging.vmodule.Set` is not checked (errcheck) logging.vmodule.Set("klog_test=2") ^ klog_test.go:367:21: Error return value of `logging.vmodule.Set` is not checked (errcheck) logging.vmodule.Set("notthisfile=2") ^ klog_test.go:459:21: Error return value of `logging.vmodule.Set` is not checked (errcheck) logging.vmodule.Set(pat) ^ klog_test.go:807:23: Error return value of `logging.verbosity.Set` is not checked (errcheck) logging.verbosity.Set("0") ^ klog_test.go:878:9: Error return value of `fs1.Set` is not checked (errcheck) fs1.Set("log_dir", "/test1") ^ klog_test.go:879:9: Error return value of `fs1.Set` is not checked (errcheck) fs1.Set("log_file_max_size", "1") ^ klog_test.go:885:9: Error return value of `fs2.Set` is not checked (errcheck) fs2.Set("log_file_max_size", "2048") ^ klog_test.go:1173:23: Error return value of `logging.verbosity.Set` is not checked (errcheck) logging.verbosity.Set("2") ^ klogr.go:35:2: field `level` is unused (unused) level int ^ klog.go:1287:2: S1017: should replace this if statement with an unconditional strings.TrimSuffix (gosimple) if strings.HasSuffix(file, ".go") { ^ klog.go:521:2: S1001: should use copy(to, from) instead of a loop (gosimple) for i := range s.vmodule.filter { ^ klog_test.go:79:2: S1001: should copy arrays using assignment instead of using a loop (gosimple) for i, w := range writers { ^ klogr/klogr.go:118:16: Error return value of `encoder.Encode` is not checked (errcheck) encoder.Encode(value) ^ klogr/klogr_test.go:208:8: Error return value of `fs.Set` is not checked (errcheck) fs.Set("skip_headers", "true") ^ klogr/klogr.go:119:27: S1030: should use buffer.String() instead of string(buffer.Bytes()) (gosimple) return strings.TrimSpace(string(buffer.Bytes())) ^ ktesting/testinglogger_test.go:176:8: Error return value of `fs.Set` is not checked (errcheck) fs.Set("alsologtostderr", "false") ^ ktesting/testinglogger_test.go:177:8: Error return value of `fs.Set` is not checked (errcheck) fs.Set("logtostderr", "false") ^ internal/buffer/buffer.go:40:2: field `next` is unused (unused) next *Buffer ^ internal/clock/clock.go:122:9: SA1015: using time.Tick leaks the underlying ticker, consider using it only in endless functions, tests and the main package, and use time.NewTicker here (staticcheck) return time.Tick(d) ^ exit_test.go:31:16: Error return value of `flag.Set` is not checked (errcheck) defer flag.Set("skip_headers", "false") ^ format_test.go:46:5: S1003: should use strings.Contains(str, "kind is config") instead (gosimple) if strings.Index(str, "kind is config") >= 0 { ^
- Loading branch information
Showing
28 changed files
with
126 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
module example | ||
module k8s.io/klog/examples | ||
|
||
go 1.13 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package require | ||
|
||
func NoError(err error) { | ||
if err != nil { | ||
panic(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
Copyright 2023 The Kubernetes Authors. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package require | ||
|
||
import "testing" | ||
|
||
func NoError(tb testing.TB, err error) { | ||
if err != nil { | ||
tb.Helper() | ||
tb.Fatalf("Unexpected error: %v", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.