-
Notifications
You must be signed in to change notification settings - Fork 18.4k

Description
What version of Go are you using (go version
)?
$ go version go version go1.17.1 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go envGO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/orizerah/Library/Caches/go-build"
GOENV="/Users/orizerah/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/orizerah/go/src/pkg/mod"
GONOPROXY="github.com/argonsecurity/"
GONOSUMDB="github.com/argonsecurity/"
GOOS="darwin"
GOPATH="/Users/orizerah/go/src"
GOPRIVATE="github.com/argonsecurity/*"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.4"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/orizerah/Workspace/go-utils/http/go.mod"
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 x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/7g/kdrr74752j53g7jtnkg4w5jm0000gn/T/go-build1893163528=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
import (
"bytes"
"encoding/json"
"net/http"
)
method := http.MethodGet
url := "test"
var buf *bytes.Buffer
if data != nil {
parsedData, err := json.Marshal(data)
if err != nil {
return nil, err
}
buf = bytes.NewBuffer(parsedData)
}
request, err := http.NewRequest(method, url, nil)
What did you expect to see?
I expected to have a request object and no error
What did you see instead?
2021-12-05T11:43:41+02:00 error layer=dap runtime error: bad access
nil access