Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ require (
github.com/golangci/dupl v0.0.0-20250308024227-f665c8d69b32
github.com/golangci/go-printf-func-name v0.1.1
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d
github.com/golangci/golines v0.0.0-20250217134842-442fd0091d95
github.com/golangci/golines v0.14.0
github.com/golangci/misspell v0.7.0
github.com/golangci/plugin-module-register v0.1.2
github.com/golangci/revgrep v0.8.0
Expand Down Expand Up @@ -184,6 +184,7 @@ require (
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ldez/structtags v0.6.1 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
Expand Down
6 changes: 4 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 13 additions & 15 deletions pkg/goformatters/golines/golines.go
Original file line number Diff line number Diff line change
@@ -1,41 +1,39 @@
package golines

import (
"github.com/golangci/golines"
"github.com/golangci/golines/shorten"

"github.com/golangci/golangci-lint/v2/pkg/config"
)

const Name = "golines"

type Formatter struct {
shortener *golines.Shortener
shortener *shorten.Shortener
}

func New(settings *config.GoLinesSettings) *Formatter {
options := golines.ShortenerConfig{}
cfg := &shorten.Config{}

if settings != nil {
options = golines.ShortenerConfig{
MaxLen: settings.MaxLen,
TabLen: settings.TabLen,
KeepAnnotations: false, // golines debug (not usable inside golangci-lint)
ShortenComments: settings.ShortenComments,
ReformatTags: settings.ReformatTags,
IgnoreGenerated: false, // handle globally
DotFile: "", // golines debug (not usable inside golangci-lint)
ChainSplitDots: settings.ChainSplitDots,
BaseFormatterCmd: "go fmt", // fake cmd
cfg = &shorten.Config{
MaxLen: settings.MaxLen,
TabLen: settings.TabLen,
KeepAnnotations: false, // golines debug (not usable inside golangci-lint)
ShortenComments: settings.ShortenComments,
ReformatTags: settings.ReformatTags,
DotFile: "", // golines debug (not usable inside golangci-lint)
ChainSplitDots: settings.ChainSplitDots,
}
}

return &Formatter{shortener: golines.NewShortener(options)}
return &Formatter{shortener: shorten.NewShortener(cfg)}
}

func (*Formatter) Name() string {
return Name
}

func (f *Formatter) Format(_ string, src []byte) ([]byte, error) {
return f.shortener.Shorten(src)
return f.shortener.Process(src)
}
Loading