go: cmd/go: error: pointer is missing a nullability type specifier when building on catalina

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

$ go version
go version go1.13.3 darwin/amd64

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="amd64"
GOBIN=""
GOCACHE="/Users/arsenegandote/Library/Caches/go-build"
GOENV="/Users/arsenegandote/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/arsenegandote/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.13.3/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.13.3/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_9/v2g8jyjj051bj38hln17lchw0000gn/T/go-build584306134=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

go test -mod=vendor <folder>

What did you expect to see?

At least the test should run

What did you see instead?

runtime/cgo

In file included from _cgo_export.c:3: /usr/local/include/stdlib.h:134:25: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:134:25: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:134:25: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:135:22: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:135:22: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:135:22: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:136:23: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:136:23: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:136:23: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:139:20: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:139:20: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:139:20: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:141:26: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:141:26: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:141:26: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:141:45: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:141:45: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:141:45: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:142:59: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:142:59: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:142:59: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:142:73: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:142:73: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:142:73: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:141:6: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:141:6: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:141:6: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:147:25: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:147:25: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:147:25: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:147:6: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:147:6: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:147:6: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:156:23: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:156:23: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:156:23: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:157:26: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:157:26: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:157:26: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:157:52: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:157:52: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:157:52: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:158:21: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:158:21: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:158:21: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:158:46: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:158:46: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:158:46: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:160:18: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:160:18: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:160:18: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:161:43: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:161:43: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:161:43: note: insert ‘_Nonnull’ if the pointer should never be null /usr/local/include/stdlib.h:161:57: error: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Werror,-Wnullability-completeness] /usr/local/include/stdlib.h:161:57: note: insert ‘_Nullable’ if the pointer may be null /usr/local/include/stdlib.h:161:57: note: insert ‘_Nonnull’ if the pointer should never be null fatal error: too many errors emitted, stopping now [-ferror-limit=]

Compilation finished with exit code 2

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 22 (12 by maintainers)

Commits related to this issue

Most upvoted comments

I also have same problem after upgrade to catalina

export CGO_CPPFLAGS="-Wno-error -Wno-nullability-completeness -Wno-expansion-to-defined"

Maybe it can be solved

I just upgraded to Catalina and also had issues with clang throwing warnings.

Turns out this was caused by having installed clang via homebrew. brew remove llvm fixed the issue.

So perhaps https://go-review.googlesource.com/c/go/+/205457/ is only needed to support users who have installed their own version of clang?