Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/gofmt: weird indentation with block comments #18791

Open
rakyll opened this issue Jan 26, 2017 · 4 comments
Open

cmd/gofmt: weird indentation with block comments #18791

rakyll opened this issue Jan 26, 2017 · 4 comments
Assignees
Labels
Milestone

Comments

@rakyll
Copy link
Contributor

@rakyll rakyll commented Jan 26, 2017

Please answer these questions before submitting your issue. Thanks!

What did you do?

Block comments are formatted weirdly.

			/*
			* - Remove package from manifest
			*	- if the package IS NOT being used, solving should do what we want
			*	- if the package IS being used:
			*		- Desired behavior: stop and tell the user, unless --force
			*		- Actual solver behavior: ?
			 */

What did you expect to see?

Comment beginner and ender is aligned correctly even though it requires adding indentation with spaces.

			/*
			 * - Remove package from manifest
			 *	- if the package IS NOT being used, solving should do what we want
			 *	- if the package IS being used:
			 *		- Desired behavior: stop and tell the user, unless --force
			 *		- Actual solver behavior: ?
			 */

System details

go version devel +6a3c6c0 Sat Jan 14 05:57:07 2017 +0000 darwin/amd64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/jbd"
GORACE=""
GOROOT="/Users/jbd/go"
GOTOOLDIR="/Users/jbd/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/lq/qcn67khn4_1b41_g48x3zchh005d21/T/go-build547869116=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
GOROOT/bin/go version: go version devel +6a3c6c0 Sat Jan 14 05:57:07 2017 +0000 darwin/amd64
GOROOT/bin/go tool compile -V: compile version devel +6a3c6c0 Sat Jan 14 05:57:07 2017 +0000 X:framepointer
uname -v: Darwin Kernel Version 15.6.0: Wed Nov  2 20:30:56 PDT 2016; root:xnu-3248.60.11.1.2~2/RELEASE_X86_64
ProductName:	Mac OS X
ProductVersion:	10.11.6
BuildVersion:	15G1212
lldb --version: lldb-360.1.70
@rakyll
Copy link
Contributor Author

@rakyll rakyll commented Jan 26, 2017

@rakyll rakyll added this to the Go1.9Maybe milestone Jan 26, 2017
@griesemer griesemer self-assigned this Jan 26, 2017
@griesemer
Copy link
Contributor

@griesemer griesemer commented Jan 26, 2017

@rakyll It's very tricky to get this right. If the "line of stars" is aligned to start with, it works out most of the time. The problem is recognizing the "line of stars" as a line and not interfere when it's not. There's some support for the argument that gofmt should never touch comment internals in the first place. Fixing this requires meddling with the inside text of a /*-comment. Sometimes the heuristic will be wrong.

@cznic
Copy link
Contributor

@cznic cznic commented Jan 26, 2017

There's some support for the argument that gofmt should never touch comment internals in the first place.

That's exactly what I would like to see one day.

@griesemer
Copy link
Contributor

@griesemer griesemer commented Jun 19, 2017

Moving this to 1.10 as it may have wider-ranging implications.

@griesemer griesemer modified the milestones: Go1.10, Go1.9Maybe Jun 19, 2017
@rsc rsc modified the milestones: Go1.10, Go1.11 Nov 22, 2017
@bradfitz bradfitz modified the milestones: Go1.11, Unplanned May 29, 2018
@bradfitz bradfitz added the NeedsFix label May 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.