0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

macOSにGoのgolangci-lintを設定しました。

0
Posted at

環境

macOS Tahoe 26.6.2
Homebrew >=4.3.0 (shallow or no git repository)
go version go1.27.0 darwin/arm64

やったこと

自分は分けているのでbrew出来るユーザで

brew install golangci-lint

普段遣いのユーザに戻って

cd $HOME/[ソースを格納しているディレクトリー]/app
golangci-lint run
[ソースを格納しているディレクトリー]/app/CorsManager.go:27
Error return value of `file.Close` is not checked (errcheck)
        defer file.Close()

[ソースを格納しているディレクトリー]/app/CorsManager.go:34
Error return value of `json.Unmarshal` is not checked (errcheck)
        json.Unmarshal(jsonData, &conf)

[ソースを格納しているディレクトリー]/app/main.go:24
Error return value of `router.Run` is not checked (errcheck)
        router.Run(":xxxx")

[ソースを格納しているディレクトリー]/app/CorsManager.go:28
inline: cannot inline call to ioutil.ReadAll (declared using go1.27.0) into a file using go1.26.4 (govet)
        jsonData, err := ioutil.ReadAll(file)

[ソースを格納しているディレクトリー]/app/CorsManager.go:
io/ioutil has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details. (staticcheck)
        "io/ioutil"

警告を出してくれたので修正しました。以上です。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?