crowdsecurity / crowdsec

CrowdSec - the open-source and participative security solution offering crowdsourced protection against malicious IPs and access to the most advanced real-world CTI.
https://crowdsec.net
MIT License
8.82k stars 456 forks source link

Bug/Debian Bullseye/11 parser runtime.go #441

Closed egberts closed 3 years ago

egberts commented 3 years ago

Describe the bug

Followed this Wiki on how to do a master build (after git clone) on a fresh installed Debian Bullseye/testing/11.

Got an error during Go compiling of runtime.go in parser().

Perhaps this is a documentation error? Such that additional steps are required to upgrade to go v1.13 from Debian's latest v1.11?

To Reproduce Steps to reproduce the behavior:

apt-get install bash gettext whiptail curl wget
apt-get install golang
apt-get install jq
apt install brz mercurial subversion

mkdir mycrowdsec
cd mycrowdsec

git clone https://github.com/corwdsecurity/crowdsec.git
cd crowdsec
make

and it errors out here:

# make
rm -f crowdsec
go test -v ./...
# github.com/crowdsecurity/crowdsec/pkg/parser
../../pkg/parser/runtime.go:55:38: iter.IsZero undefined (type reflect.Value has no field or method IsZero)
../../pkg/parser/runtime.go:68:38: tmp.IsZero undefined (type reflect.Value has no field or method IsZero)
note: module requires Go 1.13make[1]: *** [Makefile:26: test] Error 2
make: *** [Makefile:91: test] Error 2
root # 

Expected behavior

A clean build without any error (and perhaps warning).

Technical Information (please complete the following information):

Additional context Full console output of the build:

# make
rm -f crowdsec
go test -v ./...
go: finding github.com/docker/distribution v2.7.1+incompatible
go: finding github.com/pkg/errors v0.8.1
go: finding github.com/buger/jsonparser v1.0.0
go: finding github.com/jamiealquiza/tachymeter v2.0.0+incompatible
go: finding github.com/prometheus/common v0.9.1
go: finding github.com/Microsoft/go-winio v0.4.14
go: finding github.com/dghubble/sling v1.3.0
go: finding github.com/docker/docker v17.12.0-ce-rc1.0.20200419140219-55e6d7d36faf+incompatible
go: finding golang.org/x/time v0.0.0-20191024005414-555d28b269f0
go: finding github.com/mattn/go-runewidth v0.0.9
go: finding github.com/olekukonko/tablewriter v0.0.4
go: finding github.com/google/go-querystring v1.0.0
go: finding golang.org/x/mod v0.2.0
go: finding gopkg.in/yaml.v2 v2.2.8
go: finding github.com/prometheus/client_golang v1.0.0
go: finding github.com/nxadm/tail v1.4.4
go: finding github.com/davecgh/go-spew v1.1.1
go: finding github.com/antonmedv/expr v1.8.2
go: finding github.com/jinzhu/gorm v1.9.12
go: finding github.com/opencontainers/go-digest v1.0.0-rc1
go: finding github.com/enescakir/emoji v1.0.0
go: finding github.com/matttproud/golang_protobuf_extensions v1.0.1
go: finding golang.org/x/lint v0.0.0-20200302205851-738671d3881b
go: finding github.com/oschwald/geoip2-golang v1.4.0
go: finding github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90
go: finding golang.org/x/net v0.0.0-20190613194153-d28f0bde5980
go: finding golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898
go: finding github.com/prometheus/client_model v0.2.0
go: finding github.com/opencontainers/image-spec v1.0.1
go: finding gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
go: finding golang.org/x/sys v0.0.0-20190904154756-749cb33beabd
go: finding gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
go: finding github.com/lib/pq v1.1.1
go: finding github.com/golang/protobuf v1.2.0
go: finding github.com/golang/protobuf v1.3.2
go: finding gopkg.in/natefinch/lumberjack.v2 v2.0.0
go: finding golang.org/x/sys v0.0.0-20190422165155-953cdadca894
go: finding github.com/sirupsen/logrus v1.4.1
go: finding github.com/golang/protobuf v1.3.1
go: finding gopkg.in/yaml.v2 v2.2.4
go: finding github.com/prometheus/client_golang v1.5.1
go: finding github.com/pmezard/go-difflib v1.0.0
go: finding github.com/sevlyar/go-daemon v0.1.5
go: finding github.com/hashicorp/go-version v1.2.0
go: finding github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd
go: finding github.com/beorn7/perks v1.0.1
go: finding github.com/stretchr/objx v0.1.1
go: finding github.com/sirupsen/logrus v1.5.0
go: finding golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33
go: finding github.com/cespare/xxhash/v2 v2.1.1
go: finding gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: finding golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
go: finding golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e
go: finding github.com/denisbrodbeck/machineid v1.0.1
go: finding github.com/prometheus/common v0.4.1
go: finding golang.org/x/tools v0.0.0-20200422022333-3d57cf2e726e
go: finding github.com/go-logfmt/logfmt v0.4.0
go: finding github.com/spf13/cobra v0.0.7
go: finding github.com/rivo/tview v0.0.0-20200219210816-cd38d7432498
go: finding golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
go: finding github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
go: finding golang.org/x/text v0.3.0
go: finding github.com/stretchr/testify v1.5.1
go: finding github.com/json-iterator/go v1.1.9
go: finding github.com/go-logfmt/logfmt v0.3.0
go: finding github.com/beorn7/perks v1.0.0
go: finding github.com/lucasb-eyer/go-colorful v1.0.3
go: finding golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5
go: finding github.com/spf13/viper v1.4.0
go: finding golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b
go: finding golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
go: finding github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5
go: finding github.com/oschwald/maxminddb-golang v1.6.0
go: finding github.com/mattn/go-sqlite3 v2.0.3+incompatible
go: finding github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e
go: finding github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515
go: finding golang.org/x/net v0.0.0-20181114220301-adae6a3d119a
go: finding github.com/julienschmidt/httprouter v1.2.0
go: finding github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421
go: finding github.com/coreos/etcd v3.3.10+incompatible
go: finding github.com/prometheus/procfs v0.0.2
go: finding github.com/google/btree v1.0.0
go: finding golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c
go: finding github.com/jinzhu/now v1.0.1
go: finding github.com/gogo/protobuf v1.2.1
go: finding go.uber.org/zap v1.10.0
go: finding github.com/go-sql-driver/mysql v1.4.1
go: finding github.com/magiconair/properties v1.8.0
go: finding github.com/davecgh/go-spew v1.1.0
go: finding github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
go: finding github.com/go-stack/stack v1.8.0
go: finding github.com/grpc-ecosystem/grpc-gateway v1.9.0
go: finding golang.org/x/crypto v0.0.0-20191205180655-e7c4368fe9dd
go: finding golang.org/x/text v0.3.2
go: finding github.com/logrusorgru/grokky v0.0.0-20180829062225-47edf017d42c
go: finding go.etcd.io/bbolt v1.3.2
go: finding golang.org/x/sys v0.0.0-20190412213103-97732733099d
go: finding github.com/prometheus/procfs v0.0.8
go: finding github.com/gdamore/tcell v1.3.0
go: finding github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf
go: finding golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7
go: finding github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
go: finding gopkg.in/yaml.v2 v2.2.5
go: finding github.com/stretchr/testify v1.4.0
go: finding github.com/konsorten/go-windows-terminal-sequences v1.0.1
go: finding github.com/cpuguy83/go-md2man/v2 v2.0.0
go: finding golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
go: finding gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
go: finding github.com/modern-go/reflect2 v1.0.1
go: finding google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8
go: finding github.com/gogo/protobuf v1.1.1
go: finding github.com/ugorji/go v1.1.4
go: finding github.com/mitchellh/mapstructure v1.1.2
go: finding github.com/sanity-io/litter v1.2.0
go: finding github.com/mattn/go-runewidth v0.0.4
go: finding github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
go: finding github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe
go: finding github.com/pelletier/go-toml v1.2.0
go: finding github.com/prometheus/prom2json v1.3.0
go: finding github.com/sirupsen/logrus v1.4.2
go: finding github.com/kisielk/errcheck v1.1.0
go: finding gopkg.in/yaml.v2 v2.2.1
go: finding golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756
go: finding github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5
go: finding github.com/mattn/go-runewidth v0.0.8
go: finding github.com/go-kit/kit v0.9.0
go: finding github.com/stretchr/objx v0.1.0
go: finding github.com/rivo/uniseg v0.1.0
go: finding github.com/russross/blackfriday/v2 v2.0.1
go: finding github.com/sirupsen/logrus v1.2.0
go: finding github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d
go: finding github.com/kisielk/gotool v1.0.0
go: finding google.golang.org/appengine v1.4.0
go: finding github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
go: finding github.com/spf13/pflag v1.0.3
go: finding github.com/docker/go-units v0.4.0
go: finding github.com/google/go-cmp v0.4.0
go: finding gopkg.in/resty.v1 v1.12.0
go: finding github.com/spf13/cast v1.3.0
go: finding github.com/google/go-cmp v0.3.1
go: finding golang.org/x/sys v0.0.0-20191224085550-c709ea063b76
go: finding github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b
go: finding github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
go: finding github.com/spf13/jwalterweatherman v1.0.0
go: finding github.com/kr/pretty v0.1.0
go: finding github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef
go: finding github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc
go: finding github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973
go: finding golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8
go: finding golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3
go: finding golang.org/x/net v0.0.0-20190522155817-f3200d17e092
go: finding github.com/prometheus/client_golang v0.9.1
go: finding github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742
go: finding golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4
go: finding golang.org/x/sys v0.0.0-20200122134326-e047566fdf82
go: finding github.com/jinzhu/inflection v1.0.0
go: finding golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e
go: finding golang.org/x/sync v0.0.0-20190423024810-112230192c58
go: finding go.uber.org/multierr v1.1.0
go: finding golang.org/x/crypto v0.0.0-20180904163835-0709b304e793
go: finding golang.org/x/net v0.0.0-20190620200207-3b0461eec859
go: finding golang.org/x/net v0.0.0-20180724234803-3673e40ba225
go: finding golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
go: finding golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4
go: finding golang.org/x/net v0.0.0-20181220203305-927f97764cc3
go: finding go.uber.org/atomic v1.4.0
go: finding github.com/spf13/afero v1.1.2
go: finding github.com/coreos/go-semver v0.2.0
go: finding google.golang.org/grpc v1.19.0
go: finding google.golang.org/grpc v1.21.0
go: finding gopkg.in/alecthomas/kingpin.v2 v2.2.6
go: finding github.com/gorilla/websocket v1.4.0
go: finding github.com/ghodss/yaml v1.0.0
go: finding golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
go: finding github.com/stretchr/testify v1.3.0
go: finding github.com/yuin/goldmark v1.1.27
go: finding github.com/soheilhy/cmux v0.1.4
go: finding github.com/lucasb-eyer/go-colorful v1.0.2
go: finding golang.org/x/net v0.0.0-20200226121028-0de0cce0169b
go: finding github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910
go: finding github.com/jonboulle/clockwork v0.1.0
go: finding github.com/prometheus/client_golang v0.9.3
go: finding github.com/go-kit/kit v0.8.0
go: finding github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6
go: finding github.com/stretchr/testify v1.2.2
go: finding github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d
go: finding gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7
go: finding golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3
go: finding golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
go: finding golang.org/x/sys v0.0.0-20180830151530-49385e6e1522
go: finding github.com/prometheus/common v0.7.0
go: finding github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2
go: finding golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f
go: finding github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084
go: finding golang.org/x/sys v0.0.0-20191220142924-d4481acd189f
go: finding github.com/mattn/go-runewidth v0.0.7
go: finding github.com/pkg/errors v0.8.0
go: finding github.com/prometheus/common v0.4.0
go: finding github.com/pmezard/go-difflib v0.0.0-20151028094244-d8ed2627bdf0
go: finding github.com/json-iterator/go v1.1.6
go: finding github.com/mitchellh/go-homedir v1.1.0
go: finding github.com/hashicorp/hcl v1.0.0
go: finding honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099
go: finding golang.org/x/tools v0.0.0-20180221164845-07fd8470d635
go: finding gopkg.in/yaml.v2 v2.2.2
go: finding github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77
go: finding github.com/shurcooL/sanitized_anchor_name v1.0.0
go: finding github.com/coreos/bbolt v1.3.2
go: finding github.com/google/go-cmp v0.2.0
go: finding github.com/kr/text v0.1.0
go: finding golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
go: finding golang.org/x/net v0.0.0-20180826012351-8a410e7b638d
go: finding github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4
go: finding github.com/stretchr/testify v0.0.0-20161117074351-18a02ba4a312
go: finding github.com/docker/go-connections v0.4.0
go: finding github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223
go: finding github.com/inconshreveable/mousetrap v1.0.0
go: finding github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e
go: finding github.com/containerd/containerd v1.3.4
go: finding github.com/gdamore/encoding v1.0.0
go: finding github.com/kr/pty v1.1.1
go: finding github.com/BurntSushi/toml v0.3.1
go: finding google.golang.org/appengine v1.1.0
go: finding golang.org/x/tools v0.0.0-20190114222345-bf090417da8b
go: finding golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3
go: finding github.com/konsorten/go-windows-terminal-sequences v1.0.2
go: finding github.com/mattn/go-sqlite3 v2.0.1+incompatible
go: finding golang.org/x/net v0.0.0-20190311183353-d8887717615a
go: finding github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af
go: finding github.com/prometheus/tsdb v0.7.1
go: finding gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15
go: finding github.com/dgrijalva/jwt-go v3.2.0+incompatible
go: finding github.com/client9/misspell v0.3.4
go: finding github.com/google/gofuzz v1.0.0
go: finding github.com/fsnotify/fsnotify v1.4.7
go: finding github.com/DATA-DOG/go-sqlmock v1.3.3
go: finding golang.org/x/tools v0.0.0-20190311212946-11955173bddd
go: finding github.com/golang/mock v1.1.1
go: finding github.com/prometheus/client_model v0.1.0
go: finding golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee
go: finding cloud.google.com/go v0.26.0
go: finding github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f
go: finding golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be
go: finding github.com/cespare/xxhash v1.1.0
go: finding github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce
go: finding github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954
go: finding github.com/oklog/ulid v1.3.1
go: finding github.com/OneOfOne/xxhash v1.2.2
go: finding github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72
go: downloading github.com/sevlyar/go-daemon v0.1.5
go: downloading github.com/pkg/errors v0.8.1
go: downloading github.com/prometheus/client_golang v1.5.1
go: downloading github.com/jinzhu/gorm v1.9.12
go: downloading github.com/sirupsen/logrus v1.5.0
go: downloading gopkg.in/natefinch/lumberjack.v2 v2.0.0
go: downloading gopkg.in/tomb.v2 v2.0.0-20161208151619-d5d1b5820637
go: downloading gopkg.in/yaml.v2 v2.2.8
go: downloading github.com/antonmedv/expr v1.8.2
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4
go: downloading github.com/jamiealquiza/tachymeter v2.0.0+incompatible
go: downloading github.com/jinzhu/inflection v1.0.0
go: downloading github.com/beorn7/perks v1.0.1
go: downloading github.com/prometheus/common v0.9.1
go: downloading github.com/hashicorp/go-version v1.2.0
go: downloading github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e
go: downloading github.com/dghubble/sling v1.3.0
go: downloading github.com/oschwald/maxminddb-golang v1.6.0
go: downloading github.com/cespare/xxhash/v2 v2.1.1
go: downloading github.com/logrusorgru/grokky v0.0.0-20180829062225-47edf017d42c
go: downloading github.com/golang/protobuf v1.3.2
go: downloading github.com/prometheus/procfs v0.0.8
go: downloading github.com/google/go-querystring v1.0.0
go: downloading github.com/matttproud/golang_protobuf_extensions v1.0.1
go: downloading github.com/nxadm/tail v1.4.4
go: downloading github.com/oschwald/geoip2-golang v1.4.0
go: downloading github.com/buger/jsonparser v1.0.0
go: downloading gopkg.in/alecthomas/kingpin.v2 v2.2.6
go: downloading github.com/prometheus/client_model v0.2.0
go: downloading github.com/fsnotify/fsnotify v1.4.7
go: downloading gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7
go: downloading github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d
go: downloading github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
# github.com/crowdsecurity/crowdsec/pkg/parser
../../pkg/parser/runtime.go:55:38: iter.IsZero undefined (type reflect.Value has no field or method IsZero)
../../pkg/parser/runtime.go:68:38: tmp.IsZero undefined (type reflect.Value has no field or method IsZero)
note: module requires Go 1.13make[1]: *** [Makefile:26: test] Error 2
make: *** [Makefile:91: test] Error 2
root@ns1:~/admin/firewall/crowdsec/crowdsec# make
rm -f crowdsec
go test -v ./...
# github.com/crowdsecurity/crowdsec/pkg/parser
../../pkg/parser/runtime.go:55:38: iter.IsZero undefined (type reflect.Value has no field or method IsZero)
../../pkg/parser/runtime.go:68:38: tmp.IsZero undefined (type reflect.Value has no field or method IsZero)
note: module requires Go 1.13make[1]: *** [Makefile:26: test] Error 2
make: *** [Makefile:91: test] Error 2
root #
egberts commented 3 years ago

Temporary workaround to Debian Bullseye/10.5/testing

Debian hasn't marked their golang-1.13 as the starting point yet for their latest testing (10.5) Bullseye yet.

The simple workaround is to upgrade the golang to v1.13 from its Debian-default of v1.11.

apt purge golang-1.11
apt install golang-1.13  # long time
# Now the go binary is in /usr/lib/go-1.13/bin/go
cd /usr/bin
ln -s /usr/lib/go-1.13/bin/go go

cd $HOME
mkdir  mycrowdsec
cd mycrowdsec
git clone https://github.com/crowdsecurity/crowdsec.git
cd crowdsec
make
cd cmd/crowdsec-cli
make
make install
cd ../..
cd cmd/crowdsec
make 
make  install
make systemd
systemctl enable  crowdsec
systemctl start crowdsec

And the'e ye go.

NOTE

I do not know why the make install does not work at the top-level source directory.