Skip to content

Commit

Permalink
fix: gochecknoinits using init as name
Browse files Browse the repository at this point in the history
  • Loading branch information
litsynp committed Aug 19, 2024
1 parent 17a51ee commit 4feca45
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -617,3 +617,7 @@ issues:
- gosec
- noctx
- wrapcheck
- path: internal/tests/config.go # https://github.com/golangci/golangci-lint/issues/4697
text: "don't use `init` function"
- path: internal/configs/server.go
text: "don't use `init` function"
2 changes: 1 addition & 1 deletion internal/configs/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var (
BreedsGoogleSheetsID = os.Getenv("BREEDS_GOOGLE_SHEETS_ID")
)

//nolint:gochecknoinits
//nolint:init // initializes required environment variables
func init() {
if Port == "" {
Port = "8080"
Expand Down
2 changes: 1 addition & 1 deletion internal/tests/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import "os"

var TestDatabaseURL = os.Getenv("TEST_DATABASE_URL")

//nolint:gochecknoinits
//nolint:init // initializes required environment variables
func init() {
if TestDatabaseURL == "" {
TestDatabaseURL = "postgresql://postgres:postgres@localhost:5455/pets_next_door_api_test?sslmode=disable"
Expand Down

0 comments on commit 4feca45

Please sign in to comment.