1

the problem picture is below:

# 
$ go get github.com/swaggo/gin-swagger
go get: module github.com/swaggo/gin-swagger: Get "https://goproxy.io/github.com/swaggo/gin-swagger/@v/list": x509: failed to load system roots and no roots provided; SecTrustSettingsCopyCertificates error: -25300

MyMac os version :10.13.1 (17B1003

go version: go1.16.5 darwin/amd64

and my go env is:

$ go env                                
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/caibin/Library/Caches/go-build"
GOENV="/Users/caibin/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/caibin/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/caibin/go"
GOPRIVATE=""
GOPROXY="https://goproxy.io,direct"
GOROOT="/usr/local/go"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.16.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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/zt/qmccm9gs2f98ms8ynt7y4mg40000gn/T/go-build4199856293=/tmp/go-build -gno-record-gcc-switches -fno-common"

l had set goproxy and GO111MODULE, but it is no use

heidou
  • 11
  • 1
  • l change my go version to 1.18, my terminal output: dyld: Symbol not found: _SecTrustEvaluateWithError Referenced from: /usr/local/go/bin/go Expected in: flat namespace [1] 41536 abort go get github.com/swaggo/gin-swagger – heidou Apr 04 '22 at 02:49

1 Answers1

0

According to the error message:

SecTrustSettingsCopyCertificates function is to: Obtains an array of all certificates that have trust settings in a specific trust settings domain.

The error code -25300 means errSecItemNotFound, which is a standard keychain error.

The error indicates that something wrong when trying to get certificates chain to trust some certificate.

You can try to install CA with sudo apt-get install -y ca-certificates

If this doesn't work, you might need to troubleshoot it by searching keyword "Mac" and -25300.

Some links below for your reference:

https://github.com/golang/go/issues/45326

Error when trying to obtain a certificate: The specified item could not be found in the keychain

Cyril
  • 151
  • 4