go version)?$ go version go version go1.13 windows/amd64
Yes
go env)?go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:UsersDELLAppDataLocalgo-build
set GOENV=C:UsersDELLAppDataRoaminggoenv
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:go-work
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:gopkgtoolwindows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:UsersDELLAppDataLocalTempgo-build164497938=/tmp/go-build -gno-record-gcc-switches
I think the example on the tutorial is wrong
https://blog.golang.org/gos-declaration-syntax
At the end sector 'Pointer':
they declare a variable that i think it a integer nil pointer like this: []int("hi")
but i think the author is mistook with the : []int(nil)
It run, cause it's a tutorial
the compiler throw back with the error:
.test.go:10:14: cannot convert "hi" (type string) to type []int
Back in 2010, when that article was written, there was no rune, and unicode strings were made of ints.
So in pre-1 Go releases, []int("hi") was perfectly valid. Then in Go1 rune was introduced as an alias for int32, so today you would write []rune("hi") (which works), and now []int("hi") is a compilation error.
A (very old) blog post is not really a tutorial, so I'm not sure we want to go back and retroactively change posts that were correct at the time but are not now. Labelling this as "NeedsDecision".
cc @robpike
A (very old) blog post is not really a tutorial, so I'm not sure we want to go back and retroactively change posts that were correct at the time but are not now. Labelling this as "NeedsDecision".
cc @robpike
I think if those post are still used as "valid and formal documentation" they should be updated. When I say "Formal" I mean that is given by a reliable source as google, not just a dev that works with the language. If is that not the case, I give a +1 to close the issue.
I'd leave it alone for historical reasons and also because that whole section is built around int and introducing rune might be distracting. But I'm not certain about that decision, so other opinions welcome.
How about adding a note box for all old blog articles before Go 1 to address such problems?
Most helpful comment
How about adding a note box for all old blog articles before Go 1 to address such problems?