Go version
go version go1.25rc2 darwin/arm64
Output of go env
in your module/workspace:
AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/artyom/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/artyom/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT='jsonv2,greenteagc'
GOFIPS140='off'
GOFLAGS='-ldflags=-w -trimpath'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/lb/3rk8rqs53czgb4v35w_342xc0000gn/T/go-build4169649636=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/dev/null'
GOMODCACHE='/Users/artyom/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/artyom/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/artyom/Library/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='on'
GOTELEMETRYDIR='/Users/artyom/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/artyom/Library/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.25rc2'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
Tried to see the usage of append and copy builtin functions:
go doc builtin append
go doc builtin copy
What did you see happen?
~ ¶ go doc builtin append
doc: no symbol append in package builtin
1 ~ ¶ go doc builtin copy
doc: no symbol copy in package builtin
1 ~ ¶ go doc builtin
package builtin // import "builtin"
Package builtin provides documentation for Go's predeclared identifiers.
The items documented here are not actually in package builtin but their
descriptions here allow godoc to present documentation for the language's
special identifiers.
type ComplexType complex64
type FloatType float32
type IntegerType int
type Type int
type Type1 int
What did you expect to see?
The same what I can get with using -u
flag, which took me a while to figure out (I think it used to work without it in the past):
~ ¶ go doc -u builtin copy
package builtin // import "builtin"
func copy(dst, src []Type) int
The copy built-in function copies elements from a source slice into a
destination slice. (As a special case, it also will copy bytes from a string
to a slice of bytes.) The source and destination may overlap. Copy returns
the number of elements copied, which will be the minimum of len(src) and
len(dst).
~ ¶ go doc -u builtin append
package builtin // import "builtin"
func append(slice []Type, elems ...Type) []Type
The append built-in function appends elements to the end of a slice.
If it has sufficient capacity, the destination is resliced to accommodate
the new elements. If it does not, a new underlying array will be allocated.
Append returns the updated slice. It is therefore necessary to store the
result of append, often in the variable holding the slice itself:
slice = append(slice, elem1, elem2)
slice = append(slice, anotherSlice...)
As a special case, it is legal to append a string to a byte slice, like
this:
slice = append([]byte("hello "), "world"...)
Comment From: artyom
I would prefer go doc builtin
to work like go doc -u builtin
— have a special case for that.
Note that go doc -http builtin
opens a page that shows those lowecase symbols, similar to https://pkg.go.dev/builtin
Comment From: gabyhelp
Related Issues
- cmd/doc: "builtin" package is parsed incorrectly without the -u flag #49796 (closed)
- builtin: copy should be more clear on the requirements for arguments #73899 (closed)
- cmd/doc: all identifiers for package "builtin" should be printed #12541 (closed)
- the builtin function `append` annotations looks like should be updated #48089 (closed)
Related Documentation
- The Go Programming Language Specification > Built-in functions > Appending to and copying slices
- The Go Programming Language Specification > Built-in functions > Appending to and copying slices
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)