mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 11:44:02 +03:00
Update to the latest golangci-lint
This commit is contained in:
@@ -61,7 +61,7 @@ func (a *Access) Run(cli *CLI, version string) error {
|
||||
}
|
||||
|
||||
wg := &sync.WaitGroup{}
|
||||
wg.Add(2) //nolint: gomnd
|
||||
wg.Add(2)
|
||||
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
@@ -129,7 +129,7 @@ func (a *Access) getIP(ntw mtglib.Network, protocol string) net.IP {
|
||||
|
||||
defer func() {
|
||||
io.Copy(io.Discard, resp.Body) //nolint: errcheck
|
||||
resp.Body.Close()
|
||||
resp.Body.Close() //nolint: errcheck
|
||||
}()
|
||||
|
||||
data, err := io.ReadAll(resp.Body)
|
||||
|
||||
@@ -164,7 +164,7 @@ func makeIPAllowlist(conf config.ListConfig,
|
||||
}
|
||||
|
||||
func makeEventStream(conf *config.Config, logger mtglib.Logger) (mtglib.EventStream, error) {
|
||||
factories := make([]events.ObserverFactory, 0, 2) //nolint: gomnd
|
||||
factories := make([]events.ObserverFactory, 0, 2)
|
||||
|
||||
if conf.Stats.StatsD.Enabled.Get(false) {
|
||||
statsdFactory, err := stats.NewStatsd(
|
||||
@@ -271,7 +271,7 @@ func runProxy(conf *config.Config, version string) error { //nolint: funlen
|
||||
go proxy.Serve(listener) //nolint: errcheck
|
||||
|
||||
<-ctx.Done()
|
||||
listener.Close()
|
||||
listener.Close() //nolint: errcheck
|
||||
proxy.Shutdown()
|
||||
|
||||
return nil
|
||||
|
||||
@@ -35,7 +35,7 @@ func (s *SimpleRun) Run(cli *CLI, version string) error { //nolint: cyclop,funle
|
||||
return fmt.Errorf("incorrect secret: %w", err)
|
||||
}
|
||||
|
||||
if err := conf.Concurrency.Set(strconv.FormatUint(s.Concurrency, 10)); err != nil { //nolint: gomnd
|
||||
if err := conf.Concurrency.Set(strconv.FormatUint(s.Concurrency, 10)); err != nil {
|
||||
return fmt.Errorf("incorrect concurrency: %w", err)
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ func (s *SimpleRun) Run(cli *CLI, version string) error { //nolint: cyclop,funle
|
||||
return fmt.Errorf("incorrect prefer-ip: %w", err)
|
||||
}
|
||||
|
||||
if err := conf.DomainFrontingPort.Set(strconv.FormatUint(s.DomainFrontingPort, 10)); err != nil { //nolint: gomnd
|
||||
if err := conf.DomainFrontingPort.Set(strconv.FormatUint(s.DomainFrontingPort, 10)); err != nil {
|
||||
return fmt.Errorf("incorrect domain-fronting-port: %w", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ type TypeConcurrency struct {
|
||||
}
|
||||
|
||||
func (t *TypeConcurrency) Set(value string) error {
|
||||
concurrencyValue, err := strconv.ParseUint(value, 10, 16) //nolint: gomnd
|
||||
concurrencyValue, err := strconv.ParseUint(value, 10, 16)
|
||||
if err != nil {
|
||||
return fmt.Errorf("value is not uint (%s): %w", value, err)
|
||||
}
|
||||
@@ -41,5 +41,5 @@ func (t TypeConcurrency) MarshalJSON() ([]byte, error) {
|
||||
}
|
||||
|
||||
func (t TypeConcurrency) String() string {
|
||||
return strconv.FormatUint(uint64(t.Value), 10) //nolint: gomnd
|
||||
return strconv.FormatUint(uint64(t.Value), 10)
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ type TypeErrorRate struct {
|
||||
}
|
||||
|
||||
func (t *TypeErrorRate) Set(value string) error {
|
||||
parsedValue, err := strconv.ParseFloat(value, 64) //nolint: gomnd
|
||||
parsedValue, err := strconv.ParseFloat(value, 64)
|
||||
if err != nil {
|
||||
return fmt.Errorf("value is not a float (%s): %w", value, err)
|
||||
}
|
||||
@@ -43,5 +43,5 @@ func (t TypeErrorRate) MarshalJSON() ([]byte, error) {
|
||||
}
|
||||
|
||||
func (t TypeErrorRate) String() string {
|
||||
return strconv.FormatFloat(t.Value, 'f', -1, 64) //nolint: gomnd
|
||||
return strconv.FormatFloat(t.Value, 'f', -1, 64)
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ func (t *TypeHostPort) Set(value string) error {
|
||||
return fmt.Errorf("incorrect host:port value (%v): %w", value, err)
|
||||
}
|
||||
|
||||
portValue, err := strconv.ParseUint(port, 10, 16) //nolint: gomnd
|
||||
portValue, err := strconv.ParseUint(port, 10, 16)
|
||||
if err != nil {
|
||||
return fmt.Errorf("incorrect port number (%v): %w", value, err)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ type TypePort struct {
|
||||
}
|
||||
|
||||
func (t *TypePort) Set(value string) error {
|
||||
portValue, err := strconv.ParseUint(value, 10, 16) //nolint: gomnd
|
||||
portValue, err := strconv.ParseUint(value, 10, 16)
|
||||
if err != nil {
|
||||
return fmt.Errorf("incorrect port number (%v): %w", value, err)
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ func captureOutput(filefp **os.File, callback func()) string {
|
||||
|
||||
callback()
|
||||
|
||||
writer.Close()
|
||||
writer.Close() //nolint: errcheck
|
||||
<-closeChan
|
||||
|
||||
return strings.TrimSpace(buf.String())
|
||||
|
||||
@@ -18,7 +18,7 @@ func (l Listener) Accept() (net.Conn, error) {
|
||||
}
|
||||
|
||||
if err := network.SetClientSocketOptions(conn, 0); err != nil {
|
||||
conn.Close()
|
||||
conn.Close() //nolint: errcheck
|
||||
|
||||
return nil, fmt.Errorf("cannot set TCP options: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user