Popularity
2.6
Growing
Activity
3.9
-
42
2
5
Programming language: Go
License: MIT License
Tags:
Code Analysis
usestdlibvars alternatives and similar packages
Based on the "Code Analysis" category.
Alternatively, view usestdlibvars alternatives based on common mentions on social networks and blogs.
-
Go Metalinter
DISCONTINUED. Metalinter is a tool to automatically apply all static analysis tool and report their output in normalized form. -
revive
🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint -
go-cleanarch
Clean architecture validator for go, like a The Dependency Rule and interaction between packages in your Go projects. -
goreturns
A gofmt/goimports-like tool for Go programmers that fills in Go return statements with zero values to match the func return types -
go-mod-outdated
Find outdated dependencies of your Go projects. go-mod-outdated provides a table view of the go list -u -m -json all command which lists all dependencies of a Go project and their available minor and patch updates. It also provides a way to filter indirect dependencies and dependencies without updates. -
staticcheck
staticcheck is go vet on steroids, applying a ton of static analysis checks you might be used to from tools like ReSharper for C#. -
Golint online
Lints online Go source files on GitHub, Bitbucket and Google Project Hosting using the golint package. -
blanket
blanket is a tool that helps you catch functions which don't have direct unit tests in your Go packages.
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
Promo
www.influxdata.com
Do you think we are missing an alternative of usestdlibvars or a related project?
README
usestdlibvars
A linter that detect the possibility to use variables/constants from the Go standard library.
Install
go install github.com/sashamelentyev/usestdlibvars
Usage
$ usestdlibvars -h
usestdlibvars: A linter that detect the possibility to use variables/constants from the Go standard library.
Usage: usestdlibvars [-flag] [package]
Flags:
-V print version and exit
-all
no effect (deprecated)
-c int
display offending line with this many lines of context (default -1)
-constant-kind
suggest the use of constant.Kind.String()
-cpuprofile string
write CPU profile to this file
-crypto-hash
suggest the use of crypto.Hash.String()
-debug string
debug flags, any subset of "fpstv"
-fix
apply all suggested fixes
-flags
print analyzer flags in JSON
-http-method
suggest the use of http.MethodXX (default true)
-http-status-code
suggest the use of http.StatusXX (default true)
-json
emit JSON output
-memprofile string
write memory profile to this file
-os-dev-null
suggest the use of os.DevNull
-rpc-default-path
suggest the use of rpc.DefaultXXPath
-source
no effect (deprecated)
-sql-isolation-level
suggest the use of sql.LevelXX.String()
-tags string
no effect (deprecated)
-test
indicates whether test files should be analyzed, too (default true)
-time-layout
suggest the use of time.Layout
-time-month
suggest the use of time.Month.String()
-time-weekday
suggest the use of time.Weekday.String()
-tls-signature-scheme
suggest the use of tls.SignatureScheme.String()
-trace string
write trace log to this file
-v no effect (deprecated)
Examples
package response
import (
"bytes"
"encoding/json"
"net/http"
)
// JSON marshals v to JSON, automatically escaping HTML,
// setting the Content-Type header as "application/json; charset=utf-8",
// sends an HTTP response header with the provided statusCode and
// writes the marshaled v as bytes to the connection as part of an HTTP reply.
func JSON(w http.ResponseWriter, statusCode int, v any) {
var buf bytes.Buffer
enc := json.NewEncoder(&buf)
enc.SetEscapeHTML(true)
if err := enc.Encode(v); err != nil {
http.Error(w, err.Error(), 500)
return
}
w.Header().Set("Content-Type", "application/json; charset=utf-8")
w.WriteHeader(statusCode)
if _, err := w.Write(buf.Bytes()); err != nil {
http.Error(w, err.Error(), 500)
return
}
}
usestdlibvars ./...
response.go:18:30: "500" can be replaced by http.StatusInternalServerError
response.go:24:30: "500" can be replaced by http.StatusInternalServerError