![]() (Darwin is the name of the kernel for Mac OS and amd64 is the name for the 64-bit CPU architecture from both AMD and Intel.) This tells you that this is Go version 1.15.2 on Mac OS. If everything is set up correctly, you should see something like this printed: go version go1.15.2 darwin/amd64 You can validate that your environment is set up correctly by opening up a terminal or command prompt and typing: $ go version Install the Go development tools only on computers that build Go programs. Ineffective attempt at generating random numberĬomparing runtime.GOOS or runtime.Go programs compile to a single binary and do not require any additional software to be installed in order to run them. (*net/url.URL).Query returns a copy, modifying it doesn’t change the URL Go constants cannot express negative zero Integer division of literals that results in zero Impossible comparison of interface value with untyped nilĬhecking for impossible return value from a builtin function Multiple, identical build constraints in the same fileĬomparing the address of a variable against nil This is either redundant, or a typo.Īn if/else if chain has repeated conditions and no side-effects if the condition didn’t match the first time, it won’t match the second time, eitherĬalling functions like math.Ceil on floats converted from integers doesn’t do anything usefulĬertain bitwise operations, such as x ^ 0, do not do anything usefulĭiscarding the return values of a function without side effects, making the call pointless Negating a boolean twice ( !!b) is the same as writing b. Did you mean to break out of an outer loop?Ĭomparing a value against NaN even though no value is equal to NaN The result of append will never be observed anywhereīreak statement with no effect. The variable in the loop condition never changes, are you incrementing the wrong variable?Ī function argument is overwritten before its first use Did you mean to use a pointer receiver?Ī value assigned to a variable is never read before being overwritten. The loop exits unconditionally after one iterationįield assignment that will never be observed. &*x gets simplified to x, it does not copy xĬomparing unsigned values against negative values is pointless TestMain doesn’t call os.Exit, hiding test failuresĪssigning to b.N in benchmarks distorts the resultsīinary operator has identical expressions on both sides called inside the goroutine, leading to a race conditionĮmpty critical section, did you mean to defer the unlock?Ĭalled testing.T.FailNow or SkipNow in a goroutine, which isn’t allowedĭeferred Lock right after locking, likely meant to defer Unlock instead Invalid argument in call to a strconv function Inappropriate key in call to context.WithValue It is not possible to use (*time.Timer).Reset’s return value correctlyĪtomic access to 64-bit variable must be 64-bit aligned ![]() Modifying the buffer in an io.Writer implementationĪ string cutset contains duplicate characters Using an invalid host:port pair with a net.Listen-related function Using a deprecated function, variable, constant or field Strings.Replace called with n = 0, which does nothing Consider using time.NewTicker, and only use time.Tick in tests, commands and endless functionsĬhannels used with os/signal.Notify should be buffered Non-pointer value passed to Unmarshal or Decode Io.Seeker.Seek is being called with the whence constant as the first argument, but it should be the second Various methods in the strings package expect valid UTF-8, but invalid input is providedĪ nil context.Context is being passed to a function, consider using context.TODO instead (*regexp.Regexp).FindAll called with n = 0, which will always return zero results Printf with dynamic first argument and no further arguments Suspiciously small untyped constant in time.Sleep Unsupported argument to functions in encoding/binary Explanations for all checks in Staticcheck Check
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |