Comments (2)
Similar panic in the stdlib on this file, although this one appears to be intentionally "broken" (not sure if that means gofumpt should actually panic, though):
$ gofumpt -w test/dwarf/linedirectives.go
panic: invalid line number 289 (should be < 83) [recovered]
panic: invalid line number 289 (should be < 83)
goroutine 19 [running]:
golang.org/x/tools/go/ast/astutil.Apply.func1()
/home/jonhall/go/pkg/mod/golang.org/x/[email protected]/go/ast/astutil/rewrite.go:48 +0xab
panic({0x66f1e0?, 0xc0001143d0?})
/usr/local/go/src/runtime/panic.go:914 +0x21f
go/token.(*File).MergeLine(0xc000134480, 0xc000112a48?)
/usr/local/go/src/go/token/position.go:152 +0x1c8
mvdan.cc/gofumpt/format.(*fumpter).removeLines(...)
/home/jonhall/src/gofumpt/format/format.go:249
mvdan.cc/gofumpt/format.(*fumpter).removeLinesBetween(0xc0001320a0, 0xc00015c200?, 0x5b8?)
/home/jonhall/src/gofumpt/format/format.go:257 +0x13f
mvdan.cc/gofumpt/format.(*fumpter).applyPre(0xc0001320a0, 0xc0001344f0)
/home/jonhall/src/gofumpt/format/format.go:545 +0x7b2
mvdan.cc/gofumpt/format.File.func1(0xc0001344f0)
/home/jonhall/src/gofumpt/format/format.go:109 +0x34
golang.org/x/tools/go/ast/astutil.(*application).apply(0xc0001344e0, {0x724050?, 0xc00011a420?}, {0x6bf529?, 0x0?}, 0x0?, {0x723998?, 0xc00011a3f0?})
/home/jonhall/go/pkg/mod/golang.org/x/[email protected]/go/ast/astutil/rewrite.go:199 +0x1aa
golang.org/x/tools/go/ast/astutil.(*application).apply(0xc0001344e0, {0x724078?, 0xc0001520a0?}, {0x6bf95e?, 0x40d1da?}, 0x14?, {0x724050?, 0xc00011a420?})
/home/jonhall/go/pkg/mod/golang.org/x/[email protected]/go/ast/astutil/rewrite.go:429 +0x225d
golang.org/x/tools/go/ast/astutil.(*application).applyList(0xc0001344e0, {0x724078?, 0xc0001520a0}, {0x6bf95e, 0x5})
/home/jonhall/go/pkg/mod/golang.org/x/[email protected]/go/ast/astutil/rewrite.go:484 +0xa5
golang.org/x/tools/go/ast/astutil.(*application).apply(0xc0001344e0, {0x7242d8?, 0xc0001143a0?}, {0x6bf699?, 0x697fe0?}, 0x6b7040?, {0x724078?, 0xc0001520a0?})
/home/jonhall/go/pkg/mod/golang.org/x/[email protected]/go/ast/astutil/rewrite.go:435 +0x230e
golang.org/x/tools/go/ast/astutil.Apply({0x724078?, 0xc0001520a0}, 0xc000128b58, 0xc000128b70)
/home/jonhall/go/pkg/mod/golang.org/x/[email protected]/go/ast/astutil/rewrite.go:53 +0x152
mvdan.cc/gofumpt/format.File(0xc000116080, 0xc0001520a0, {{0x6bf2e6, 0x2}, {0x0, 0x0}, 0x0})
/home/jonhall/src/gofumpt/format/format.go:157 +0x2d7
main.processFile({0x7ffd6c1f2e83, 0x1c}, {0x725828, 0xc0000964e0}, {0x0?, 0x0?}, 0x0?, 0x1)
/home/jonhall/src/gofumpt/gofmt.go:313 +0x308
main.gofmtMain.func3(0x0?)
/home/jonhall/src/gofumpt/gofmt.go:508 +0x34
main.(*sequencer).Add.func2()
/home/jonhall/src/gofumpt/gofmt.go:191 +0x42
created by main.(*sequencer).Add in goroutine 1
/home/jonhall/src/gofumpt/gofmt.go:190 +0x1ae
from gofumpt.
Thanks for spotting - I've never liked those line directives to be honest. They are definitely an obstacle for a formatter.
from gofumpt.
Related Issues (20)
- install as a CLI HOT 2
- Remove empty lines in if and for similar to functions HOT 13
- Proposal: Clothe naked returns HOT 10
- Breaks import comment HOT 1
- feature: Enforce line breaks between multiline function calls with func() argument HOT 1
- add simplifications for Go 1.22 HOT 1
- panic: invalid semver string: "v1.22rc2" HOT 1
- Making every added formatting rule Optional HOT 3
- missing binary release at latest version-v0.6.0 HOT 1
- Single import should not be grouped with parentheses
- Generated file not ignored HOT 2
- prevent indentation confusion
- Gofumpt removing newlines before comments HOT 7
- gofumpt is very slow when `go` is behind an asdf shim HOT 3
- Split long lines only available behind environment string
- Publish v1 HOT 2
- how to ignore certain folders? HOT 7
- Alias imported package to match the package name
- Group adjacent short variable declarations HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gofumpt.