Skip to content

x/website: inconsistent tabs in code snippets #52255

@looshch

Description

@looshch

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

$ go version
go version go1.18 darwin/arm64

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/l/Library/Caches/go-build"
GOENV="/Users/l/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/l/Projects/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/l/Projects/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/homebrew/Cellar/go/1.18/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.18/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/l/Projects/go/src/website/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/_8/v1rjtbwx7f1dk3kq2qzykk2m0000gn/T/go-build198020044=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

visited go.dev/doc/articles/wiki, go.dev/doc/effective_go, go.dev/doc/code, go.dev/doc/faq, go.dev/ref/mem, and https://go.dev/ref/spec. In some places, real tabs are used instead of 4 spaces. The problem is that the former case is equal to 8 spaces in browsers, but the majority of code on go.dev are rendered using the latter representation, so indentation is not consistent. The following screenshot is taken from go.dev/doc/articles/wiki and contains the first Go code snippet. You can copy the first tab to search for it on other pages
Screenshot 2022-04-09 at 11 24 30 p m

I made 2 PRs because some pages are not in x/website but in this repo instead. To prevent this in future, maybe I can create a test checking contents inside every <pre> tag for tabs. I could suggest to create a replacer instead, but there are some cases when it will result in messed indentation, e.g. in the spec. What do you think?

What did you expect to see?

consistent indentation

What did you see instead?

inconsistent one

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.website

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions