Comments (2)
I can't reproduce this error, could you list a more detailed reproduction process? thanks!
My steps:
> go version
go version go1.16.15 linux/amd64
> git clone https://github.com/bytedance/gopkg.git && cd gopkg && go test ./...
go: downloading golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
go: downloading github.com/stretchr/testify v1.7.0
go: downloading golang.org/x/sys v0.0.0-20221010170243-090e33056c14
go: downloading gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
go: downloading github.com/davecgh/go-spew v1.1.0
ok github.com/bytedance/gopkg/cache/asynccache 6.819s
ok github.com/bytedance/gopkg/cloud/circuitbreaker 18.233s
ok github.com/bytedance/gopkg/cloud/metainfo 0.002s
ok github.com/bytedance/gopkg/collection/hashset 0.121s
ok github.com/bytedance/gopkg/collection/lscq 0.361s
ok github.com/bytedance/gopkg/collection/skipmap 0.348s
ok github.com/bytedance/gopkg/collection/skipset 0.132s
ok github.com/bytedance/gopkg/collection/zset 0.029s
? github.com/bytedance/gopkg/internal/benchmark/linkedq [no test files]
? github.com/bytedance/gopkg/internal/benchmark/msq [no test files]
? github.com/bytedance/gopkg/internal/hack [no test files]
ok github.com/bytedance/gopkg/internal/runtimex 0.002s
ok github.com/bytedance/gopkg/internal/wyhash 0.205s
ok github.com/bytedance/gopkg/lang/fastrand 0.028s
ok github.com/bytedance/gopkg/lang/mcache 0.002s
ok github.com/bytedance/gopkg/lang/stringx 0.002s
ok github.com/bytedance/gopkg/lang/syncx 0.116s
ok github.com/bytedance/gopkg/util/gctuner 0.025s
ok github.com/bytedance/gopkg/util/gopool 0.015s
? github.com/bytedance/gopkg/util/logger [no test files]
ok github.com/bytedance/gopkg/util/xxhash3 0.369s
? github.com/bytedance/gopkg/util/xxhash3/internal/xxh3_raw [no test files]
from gopkg.
This is because bytedance/gopkg doesn't depend on golang.org/x/sys/unix. Let's create a package that depends on it then you will see the problem:
- setup
$ /usr/local/go1.16.15/bin/go version
go version go1.16.15 linux/amd64
$ mkdir -p ~/go/src/test/issue163 && cd ~/go/src/test/issue163
$ touch go.mod
$ touch main.go
- create main.go
//go:build linux
// +build linux
package main
import (
"github.com/bytedance/gopkg/util/gopool"
"golang.org/x/sys/unix"
)
func main() {
_ = gopool.NewPool
_ = unix.Fadvise
}
- create go.mod
module test/issue163
go 1.16
- go mod tidy
$ /usr/local/go1.16.15/bin/go mod tidy
go: finding module for package golang.org/x/sys/unix
go: finding module for package github.com/bytedance/gopkg/util/gopool
go: found github.com/bytedance/gopkg/util/gopool in github.com/bytedance/gopkg v0.0.0-20221122125632-68358b8ecec6
go: found golang.org/x/sys/unix in golang.org/x/sys v0.3.0
after current step our go.mod will look like this:
module test/issue163
go 1.16
require (
github.com/bytedance/gopkg v0.0.0-20221122125632-68358b8ecec6
golang.org/x/sys v0.3.0
)
- go build
$ /usr/local/go1.16.15/bin/go build
# golang.org/x/sys/unix
../../../pkg/mod/golang.org/x/[email protected]/unix/syscall.go:83:16: undefined: unsafe.Slice
../../../pkg/mod/golang.org/x/[email protected]/unix/syscall_linux.go:2256:9: undefined: unsafe.Slice
../../../pkg/mod/golang.org/x/[email protected]/unix/syscall_unix.go:118:7: undefined: unsafe.Slice
../../../pkg/mod/golang.org/x/[email protected]/unix/sysvshm_unix.go:33:7: undefined: unsafe.Slice
note: module requires Go 1.17
- downgrade golang.org/x/sys and test it again
- modify our go.mod
module test/issue163
go 1.16
require (
github.com/bytedance/gopkg v0.0.0-20221122125632-68358b8ecec6
golang.org/x/sys v0.0.0-20220110181412-a018aaa089fe
)
NOTE: a commonly used library in ByteDance use golang.org/x/sys v0.0.0-20220110181412-a018aaa089fe
- go mod tidy
$ /usr/local/go1.16.15/bin/go mod tidy
then our go.mod will look like this:
module test/issue163
go 1.16
require (
github.com/bytedance/gopkg v0.0.0-20221122125632-68358b8ecec6
golang.org/x/sys v0.0.0-20221010170243-090e33056c14
)
the version of golang.org/x/sys will be changed to v0.0.0-20221010170243-090e33056c14 since bytedance/gopkg choose it.
- go build
$ /usr/local/go1.16.15/bin/go build
# golang.org/x/sys/unix
../../../pkg/mod/golang.org/x/[email protected]/unix/syscall.go:83:16: undefined: unsafe.Slice
../../../pkg/mod/golang.org/x/[email protected]/unix/syscall_linux.go:2255:9: undefined: unsafe.Slice
../../../pkg/mod/golang.org/x/[email protected]/unix/syscall_unix.go:118:7: undefined: unsafe.Slice
../../../pkg/mod/golang.org/x/[email protected]/unix/sysvshm_unix.go:33:7: undefined: unsafe.Slice
note: module requires Go 1.17
from gopkg.
Related Issues (20)
- how to pass variable to gopool function? HOT 1
- GoPool's performance in comparison to other goroutine pool implementations HOT 12
- gc tunner not Use in not web application
- Can 'gopool' support the extended use case of 'errgroup'? HOT 1
- gopool的RegisterPool使用不了 HOT 1
- util/gctuner: test fail randomly HOT 2
- Go version: bump minimum version to 1.17
- 如何动态修改熔断器配置 HOT 1
- missing comments of fastrand.Float32 / fastrand.Float64 methods
- Reporting a vulnerability
- a little improvement for `cacheRemap16Byte` HOT 2
- closed
- asynccache的OOM问题
- circuitbreaker Panel 接口添加 State 方法
- logger 中default 的 calldepth = 3 会导致输出Log 无法定位实际输出
- 使用zset(skiplist)时,发现其remove,incr, updateScore比想象中的慢非常多 HOT 1
- gopool中的f func()能否新增可入参的 func()类型? HOT 2
- skipmap在32位系统下运行crash HOT 2
- Test HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gopkg.