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: nested/indented unordered list elements are flattened #54129

Closed
alexzielenski opened this issue Jul 29, 2022 · 2 comments
Closed

cmd/gofmt: nested/indented unordered list elements are flattened #54129

alexzielenski opened this issue Jul 29, 2022 · 2 comments

Comments

@alexzielenski
Copy link

alexzielenski commented Jul 29, 2022

What version of Go are you using (go version)?

$ go version
go version go1.19rc2 darwin/arm64

Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/alex/Library/Caches/go-build"
GOENV="/Users/alex/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/alex/.asdf/installs/golang/1.19rc2/packages/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/alex/.asdf/installs/golang/1.19rc2/packages"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/alex/.asdf/installs/golang/1.19rc2/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/alex/.asdf/installs/golang/1.19rc2/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19rc2"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/alex/go/src/sigs.k8s.io/structured-merge-diff/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/7d/1k1707_n2d544j7kdlygglxh0000gn/T/go-build1613964649=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Go gofmt on https://github.com/kubernetes-sigs/structured-merge-diff/blob/5e8be978e85123cab4e5cda730d0859172e6aeaf/typed/typed.go#L100-L111

What did you expect to see?

The nested/indented structure of the unordered list to be preserved

// Merge returns the result of merging tv and pso ("partially specified
// object") together. Of note:
//   - No fields can be removed by this operation.
//   - If both tv and pso specify a given leaf field, the result will keep pso's
//     value.
//   - Container typed elements will have their items ordered:
//       - like tv, if pso doesn't change anything in the container
//       - like pso, if pso does change something in the container.
//
// tv and pso must both be of the same type (their Schema and TypeRef must
// match), or an error will be returned. Validation errors will be returned if
// the objects don't conform to the schema.

What did you see instead?

// Merge returns the result of merging tv and pso ("partially specified
// object") together. Of note:
//   - No fields can be removed by this operation.
//   - If both tv and pso specify a given leaf field, the result will keep pso's
//     value.
//   - Container typed elements will have their items ordered:
//   - like tv, if pso doesn't change anything in the container
//   - like pso, if pso does change something in the container.
//
// tv and pso must both be of the same type (their Schema and TypeRef must
// match), or an error will be returned. Validation errors will be returned if
// the objects don't conform to the schema.
@seankhliao
Copy link
Member

I think this is working as designed:

List items only contain paragraphs, not code blocks or nested lists. This avoids any space-counting subtlety as well as questions about how many spaces a tab counts for in inconsistent indentation.

cc @rsc

@cherrymui
Copy link
Member

Yes, this works as intended. Thanks.

@cherrymui cherrymui closed this as not planned Won't fix, can't repro, duplicate, stale Jul 29, 2022
@golang golang locked and limited conversation to collaborators Jul 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants