var Me = Developer{
Name: "Manuel Doncel Martos",
Skills: [][]string{
{"Java", "Spring Boot"},
{"Go", "Python"},
{"Kubernetes", "Docker"},
},
Interests: []string {
"Open Source", "Domain Driven Design", "Football",
},
}
Golangci-lint is a fast linters runner for Go.
@startuml
skinparam backgroundColor transparent
skinparam monochrome reverse
!option handwritten true
revive - [golangci-lint]
gofmt - [golangci-lint]
gofumpt - [golangci-lint]
gci - [golangci-lint]
... - [golangci-lint]
funcorder -- [golangci-lint]
embeddedstructfieldcheck -- [golangci-lint]
@enduml
version: 2
Others:
@startwbs
skinparam backgroundColor transparent
skinparam monochrome reverse
!option handwritten true
* ast.File
** ast.GenDecl
*** ast.ImportSpec
**** ast.BasicLit
** ast.GenDecl
*** ast.ValueSpec
**** ast.Ident
**** ast.BasicLit
** ast.GenDecl
*** ast.TypeSpec
*** ast.StructType
**** ast.FieldList
***** ast.Field
***** ast.Field
** ast.FuncDecl
*** ast.FuncType
*** ast.FieldList
**** ast.Field
**** ast.Field
** ...
@endwbs
File to test: here
Package golang.org/x/tools
Prefix unexported globals with
const myConstant = "myConstant"
const errNotFound = "not found"
const _myConstant = "myConstant"
const errNotFound = "not found"
// ❌ constructor before
// struct declaration
func NewMyStruct() *MyStruct {
return &MyStruct{}
}
type MyStruct struct {
Name string
}
// ❌ unexported method
// placed before exported method
func (m MyStruct) lenName() int {
return len(m.Name)
}
func (m MyStruct) GetName() string {
return m.Name
}
...
type Client struct {
version int
http.Client
}
type MyStruct struct {
Name string
}
// ✅ constructor after
// struct declaration and
// before methods
func NewMyStruct() *MyStruct {
return &MyStruct{}
}
// ✅ exported methods before
// unexported methods
func (m MyStruct) GetName() string {
return m.Name
}
func (m MyStruct) lenName() int {
return len(m.Name)
}
...
type Client struct {
version int
http.Client
}
type Client struct {
http.Client
version int
}
More info: Module Plugin
Example here: Custom Plugin