feat: use go1.16 and resources embedding (#235)

* feat: use go1.16 embedding for resources

We want to embed everything that can be easily embedded. We should, at a
minimum, replace the downloading of resources and bindata.

Ref: https://github.com/ooni/probe/issues/1367.

* fix: get rid of bindata and use go embed instead

* fix: start unbreaking some automatic tests

* fix: fetch resources as part of the mobile build

* fix: convert more stuff to go1.16

I still expect many breakages, but we'll fix them.

* fix: make the windows CI green

* fix: get resources before running QA

* fix: go1.16 uses modules by default

* hopefully fix all other outstanding issues

* fix(QA/telegram.py): add another DC IP address

* Apply suggestions from code review
This commit is contained in:
Simone Basso 2021-03-02 12:08:24 +01:00 committed by GitHub
commit 322394fe63
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
51 changed files with 439 additions and 778 deletions

View file

@ -12,6 +12,7 @@ case $1 in
;;
windows_amd64)
go run ./internal/cmd/getresources
# Note! This assumes we've installed the mingw-w64 compiler.
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc \
go build -ldflags='-s -w' ./cmd/ooniprobe
@ -22,6 +23,7 @@ case $1 in
;;
windows_386)
go run ./internal/cmd/getresources
# Note! This assumes we've installed the mingw-w64 compiler.
GOOS=windows GOARCH=386 CGO_ENABLED=1 CC=i686-w64-mingw32-gcc \
go build -ldflags='-s -w' ./cmd/ooniprobe
@ -38,15 +40,17 @@ case $1 in
;;
linux_amd64)
docker pull --platform linux/amd64 golang:1.14-alpine
docker run --platform linux/amd64 -v`pwd`:/ooni -w/ooni golang:1.14-alpine ./build.sh _alpine
go run ./internal/cmd/getresources
docker pull --platform linux/amd64 golang:1.16-alpine
docker run --platform linux/amd64 -v`pwd`:/ooni -w/ooni golang:1.16-alpine ./build.sh _alpine
tar -cvzf ooniprobe_${v}_linux_amd64.tar.gz LICENSE.md Readme.md ooniprobe
mv ooniprobe ./CLI/linux/amd64/
;;
linux_386)
docker pull --platform linux/386 golang:1.14-alpine
docker run --platform linux/386 -v`pwd`:/ooni -w/ooni golang:1.14-alpine ./build.sh _alpine
go run ./internal/cmd/getresources
docker pull --platform linux/386 golang:1.16-alpine
docker run --platform linux/386 -v`pwd`:/ooni -w/ooni golang:1.16-alpine ./build.sh _alpine
tar -cvzf ooniprobe_${v}_linux_386.tar.gz LICENSE.md Readme.md ooniprobe
mv ooniprobe ./CLI/linux/386/
;;
@ -60,6 +64,7 @@ case $1 in
macos|darwin)
set -x
go run ./internal/cmd/getresources
# Note! The following line _assumes_ you have a working C compiler. If you
# have Xcode command line tools installed, you are fine.
go build -ldflags='-s -w' ./cmd/ooniprobe
@ -79,7 +84,7 @@ case $1 in
set +x
echo "Usage: $0 darwin|linux|macos|windows|release"
echo ""
echo "You need a C compiler and Go >= 1.14. The C compiler must be a"
echo "You need a C compiler and Go >= 1.16. The C compiler must be a"
echo "UNIX like compiler like GCC, Clang, Mingw-w64."
echo ""
echo "To build a static Linux binary, we use Docker and Alpine. We currently"