gpt4 book ai didi

linux - gocql package golang 两个文件版本在同一个安装

转载 作者:数据小太阳 更新时间:2023-10-29 03:24:41 28 4
gpt4 key购买 nike

尝试运行 go 文件(应该运行)时出现此错误

clusterCfg.ConnectTimeout undefined (type *gocql.ClusterConfig has no field 
or method ConnectTimeout)
  1. 当我查看 go 1.7 的文档时,我发现 ClusterConfig 确实有一个字段 ConnectTimeout。 (转到版本 = 1.7)。
  2. 如果我转到我的 go 路径中的 github.com 目录,我会找到一个目录 gocql。在这个目录中,我找到了一个文件 cluster.go,其中包含一个结构 ClusterConfig 的定义,它没有 ConnectTimeout 只有一个字段 Timeout。

go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/developer/gocode"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-
map=/tmp/go-build098468995=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

    {
"Dir": "/home/developer/gocode/src/github.com/gocql/gocql",
"ImportPath": "github.com/gocql/gocql",
"Name": "gocql",
"Doc": "Package gocql implements a fast and robust Cassandra driver
for the Go programming language.",
"Target":
"/home/developer/gocode/pkg/linux_amd64/github.com/gocql/gocql.a",
"Root": "/home/developer/gocode",
"GoFiles": [
"address_translators.go",
"cluster.go",
"compressor.go",
"conn.go",
"connectionpool.go",
"control.go",
"debug_off.go",
"doc.go",
"errors.go",
"events.go",
"filters.go",
"frame.go",
"helpers.go",
"host_source.go",
"marshal.go",
"metadata.go",
"policies.go",
"prepared_cache.go",
"query_executor.go",
"ring.go",
"session.go",
"token.go",
"topology.go",
"uuid.go"
],
"IgnoredGoFiles": [
"batch_test.go",
"cass1batch_test.go",
"cassandra_test.go",
"compressor_test.go",
"conn_test.go",
"debug_on.go",
"errors_test.go",
"events_ccm_test.go",
"fuzz.go",
"marshal_test.go",
"session_test.go",
"stress_test.go",
"topology_test.go",
"tuple_test.go",
"udt_test.go",
"uuid_test.go",
"wiki_test.go"
],
"Imports": [
"bufio",
"bytes",
"crypto/md5",
"crypto/rand",
"crypto/tls",
"crypto/x509",
"encoding/binary",
"encoding/hex",
"encoding/json",
"errors",
"fmt",
"github.com/gocql/gocql/internal/lru",
"github.com/gocql/gocql/internal/murmur",
"github.com/gocql/gocql/internal/streams",
"github.com/golang/snappy",
"github.com/hailocab/go-hostpool",
"golang.org/x/net/context",
"gopkg.in/inf.v0",
"io",
"io/ioutil",
"log",
"math",
"math/big",
"math/rand",
"net",
"reflect",
"regexp",
"runtime",
"sort",
"strconv",
"strings",
"sync",
"sync/atomic",
"time",
"unicode"
],
"Deps": [
"bufio",
"bytes",
"container/list",
"context",
"crypto",
"crypto/aes",
"crypto/cipher",
"crypto/des",
"crypto/dsa",
"crypto/ecdsa",
"crypto/elliptic",
"crypto/hmac",
"crypto/md5",
"crypto/rand",
"crypto/rc4",
"crypto/rsa",
"crypto/sha1",
"crypto/sha256",
"crypto/sha512",
"crypto/subtle",
"crypto/tls",
"crypto/x509",
"crypto/x509/pkix",
"encoding",
"encoding/asn1",
"encoding/base64",
"encoding/binary",
"encoding/hex",
"encoding/json",
"encoding/pem",
"errors",
"fmt",
"github.com/gocql/gocql/internal/lru",
"github.com/gocql/gocql/internal/murmur",
"github.com/gocql/gocql/internal/streams",
"github.com/golang/snappy",
"github.com/hailocab/go-hostpool",
"golang.org/x/net/context",
"gopkg.in/inf.v0",
"hash",
"hash/crc32",
"internal/nettrace",
"internal/race",
"internal/singleflight",
"internal/syscall/unix",
"io",
"io/ioutil",
"log",
"math",
"math/big",
"math/rand",
"net",
"os",
"path/filepath",
"reflect",
"regexp",
"regexp/syntax",
"runtime",
"runtime/cgo",
"runtime/internal/atomic",
"runtime/internal/sys",
"sort",
"strconv",
"strings",
"sync",
"sync/atomic",
"syscall",
"time",
"unicode",
"unicode/utf16",
"unicode/utf8",
"unsafe"
],
"TestGoFiles": [
"address_translators_test.go",
"cluster_test.go",
"common_test.go",
"control_test.go",
"events_test.go",
"filters_test.go",
"frame_test.go",
"framer_bench_test.go",
"host_source_test.go",
"metadata_test.go",
"policies_test.go",
"ring_test.go",
"session_connect_test.go",
"token_test.go"
],
"TestImports": [
"bytes",
"compress/gzip",
"flag",
"fmt",
"github.com/hailocab/go-hostpool",
"golang.org/x/net/context",
"io/ioutil",
"log",
"math/big",
"net",
"os",
"sort",
"strconv",
"strings",
"sync",
"testing",
"time"
]
}

我做错了什么?我怎样才能拥有同一个文件的两个版本?我该如何解决?

最佳答案

这不是答案,而是解决方案。我没有继续尝试挽救虚拟机,而是得到了另一张图片并从那里开始。

关于linux - gocql package golang 两个文件版本在同一个安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45243027/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com