-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some experiments with golang linters
- Loading branch information
Showing
6 changed files
with
87 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
output: | ||
formats: colored-line-number | ||
print-issued-lines: true | ||
print-linter-name: true | ||
|
||
linters: | ||
enable-all: true | ||
disable: | ||
- stylecheck | ||
- revive | ||
- wsl | ||
- gofmt | ||
- gosimple | ||
- gofumpt | ||
- goimports | ||
- nlreturn | ||
- exportloopref | ||
fast: false | ||
|
||
issues: | ||
exclude-use-default: false | ||
max-issues-per-linter: 100 | ||
max-same-issues: 4 | ||
nes: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
install: | ||
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.62.2 | ||
lint: | ||
@golangci-lint run ./... -v | ||
lint_autofix: | ||
@GO111MODULE=on $(GOLINT) run ./ -v --fix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module someexample | ||
|
||
go 1.23.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package someexample | ||
|
||
// Person -. | ||
type Person struct { | ||
Name string | ||
Age int | ||
} | ||
|
||
// GetName blah | ||
func (p Person) GetName() string { | ||
return p.Name | ||
} | ||
|
||
type Avatar struct { | ||
URL string | ||
Size int64 | ||
} | ||
|
||
// Client -. | ||
type Client struct { | ||
ID int64 | ||
Img Avatar | ||
Name string | ||
Age int64 | ||
} | ||
|
||
// HasAvatar === | ||
func (c Client) HasAvatar() bool { | ||
if c.Img.URL != "" { | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
// UpdateAvatar ... | ||
func (c *Client) UpdateAvatar() { | ||
c.Img.URL = "new_url" | ||
} | ||
|
||
// GetName -. | ||
func (c Client) GetName() string { | ||
return c.Name | ||
} | ||
|
||
//NewClient -. | ||
func NewClient(name string, age int, img Avatar) *Client { | ||
return &Client{ | ||
ID: 7, | ||
Name: name, | ||
Age: int64(age), | ||
Img: img, | ||
} | ||
} |