linters/internal/analyzers/noliteral/test-case/const-location/positive._go
Alexander Chuprov 7b767571bc
All checks were successful
Tests and linters / Build lib (pull_request) Successful in 1m17s
Tests and linters / Tests (pull_request) Successful in 1m7s
Tests and linters / Staticcheck (pull_request) Successful in 1m19s
Tests and linters / Lint (pull_request) Successful in 1m49s
[#16] noliteral: Fix nested functions
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
2024-02-13 19:45:34 +03:00

83 lines
1.8 KiB
Text

package logs //declaration package
/*After upgrading to golangci-lint version 1.5.4 and adding linter configuration, it will be possible to get rid of 'magic repositories'*/
import (
"fmt"
tochno_ne_dly_const_log "git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"// The alias of the package with constants differs from the one used
)
func (c *cfg) info_ok() {
c.log.Info(tochno_ne_dly_const_log.MSG)
}
func (c *cfg) debug_ok() {
c.log.Debug(tochno_ne_dly_const_log.MSG)
}
func (c *cfg) error_ok() {
c.log.Error(tochno_ne_dly_const_log.MSG)
}
func (c *cfg) custom_ok_const() {
c.log.Abyr(tochno_ne_dly_const_log.MSG)
}
// issue: https://git.frostfs.info/TrueCloudLab/linters/issues/16.
// Check that the check does not trigger a false positive for "zap.Error(invalid_pkg.Error)" passed as an argument.
func (c *cfg) debug1_ok() {
c.log.Debug(tochno_ne_dly_const_log.MSG, zap.Stringer("cid", bkt.CID), zap.String("oid", obj.VersionID), zap.Error(invalid_pkg.Error))
}
func (c *cfg) error_ok() {
field:=zap.Error(invalid_pkg.Error)
}
func (c *cfg) error_ok() {
callBack:=&zap.Error(invalid_pkg.Error)
}
func (c *cfg) error_ok() {
field=zap.Error(invalid_pkg.Error)
}
func (c *cfg) error_ok() {
callBack=&zap.Error(invalid_pkg.Error)
}
type Logger interface {
Debug(msg string)
Info(msg string)
Warn(msg string)
Error(msg string)
Abyr(msg string)
}
type RealLogger struct{}
func (l RealLogger) Debug(msg string) {
}
func (l RealLogger) Info(msg string) {
}
func (l RealLogger) Warn(msg string) {
}
func (l RealLogger) Error(msg string) {
}
func (l RealLogger) Abyr(msg string) {
}
type RealLogger struct{}
func (l RealLogger) Info(msg string) {
fmt.Println(msg)
}
var logs = struct {
MSG string
}{
MSG: "some message",
}
type cfg struct {
log Logger
}