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:
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"_version": 1,
|
||||
"_informed_consent": false,
|
||||
"sharing": {
|
||||
"upload_results": true
|
||||
},
|
||||
"nettests": {
|
||||
"websites_url_limit": 0
|
||||
},
|
||||
"advanced": {
|
||||
"send_crash_reports": true
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package ooni
|
||||
|
||||
import (
|
||||
_ "embed" // because we embed a file
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -8,7 +9,6 @@ import (
|
||||
"syscall"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/ooni/probe-cli/v3/cmd/ooniprobe/internal/bindata"
|
||||
"github.com/ooni/probe-cli/v3/cmd/ooniprobe/internal/config"
|
||||
"github.com/ooni/probe-cli/v3/cmd/ooniprobe/internal/database"
|
||||
"github.com/ooni/probe-cli/v3/cmd/ooniprobe/internal/enginex"
|
||||
@@ -239,6 +239,9 @@ func MaybeInitializeHome(home string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
//go:embed default-config.json
|
||||
var defaultConfig []byte
|
||||
|
||||
// InitDefaultConfig reads the config from common locations or creates it if
|
||||
// missing.
|
||||
func InitDefaultConfig(home string) (*config.Config, error) {
|
||||
@@ -252,12 +255,7 @@ func InitDefaultConfig(home string) (*config.Config, error) {
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
log.Debugf("writing default config to %s", configPath)
|
||||
var data []byte
|
||||
data, err = bindata.Asset("data/default-config.json")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err = ioutil.WriteFile(configPath, data, 0644); err != nil {
|
||||
if err = ioutil.WriteFile(configPath, defaultConfig, 0644); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// If the user did the informed consent procedure in
|
||||
|
||||
Reference in New Issue
Block a user