Closed
Description
What version of Go are you using (go version
)?
1.10.3 windows/amd64
What operating system and processor architecture are you using (go env
)?
win 8.1 amd64
go env
Output
C:\Users\Administrator>go env set GOARCH=amd64 set GOBIN= set GOCACHE=C:\Users\Administrator\AppData\Local\go-build set GOEXE=.exe set GOHOSTARCH=amd64 set GOHOSTOS=windows set GOOS=windows set GOPATH=C:\Users\Administrator\go set GORACE= set GOROOT=C:\Go set GOTMPDIR= set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64 set GCCGO=gccgo set CC=gcc set CXX=g++ set CGO_ENABLED=1 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 -fmessage-length=0 -fdebug-prefix-map=C:\Users\ADMINI~1\AppData\Local\Temp\go-build237241822=/tmp/go-build -gno-record-gcc-switches
Proposal for C Style nil checking
Instead of
if err != nil { panic("Error occurred") } // or if r := result; r != nil { print("Result: ", r.Text) }
you could write
if err { // err is a valid interface and not nil panic("Error occurred") } // and if r := result; r { print("Result: ", r.Text) }
i think this would free up a lot of if err != nil clutter kind of how for {} is and also if statements with multiple nil checks and that this would be great with having to write less and being more productive with Go. If anyone has any better ideas i would like to hear them too to hopefully improve Go as the language evolves and this could be even applied to any other type if they can be nil