Look up environment variables and determine if they are set or not instead of checking the value

This commit is contained in:
eyedeekay 2024-08-20 19:44:31 -04:00
parent 11b284a639
commit ef53e8b599
No known key found for this signature in database
GPG key ID: D75C03B39B5E14E1
4 changed files with 6 additions and 2 deletions

View file

@ -44,6 +44,7 @@ import (
var sam, err = goSam.NewClient(*samAddr)
// Dial a network connection to an I2P server or a unix socket. Fail for clearnet addresses.
func Dial(network, addr string) (net.Conn, error) {
if err != nil {
return nil, err

View file

@ -14,9 +14,10 @@ import (
// Generate HTML with coverage: go tool cover -html=/somewhere/where/there/is/integrationcover.out -o cover.html
// Source: https://dzone.com/articles/measuring-integration-test-coverage-rate-in-pouchc
func TestMain(t *testing.T) {
if os.Getenv("CI") != "" {
if _, ex := os.LookupEnv("CI"); ex {
t.Skip("skipping test, as no TOR/I2P client is available")
} else {
t.Log("running locally, continuing with tests")
var (
args []string
)

View file

@ -14,9 +14,10 @@ import (
// Generate HTML with coverage: go tool cover -html=/somewhere/where/there/is/integrationcover.out -o cover.html
// Source: https://dzone.com/articles/measuring-integration-test-coverage-rate-in-pouchc
func TestMain(t *testing.T) {
if os.Getenv("CI") != "" {
if _, ex := os.LookupEnv("CI"); ex {
t.Skip("skipping test, as no TOR/I2P client is available")
} else {
t.Log("running locally, continuing with tests")
var (
args []string
)

View file

@ -43,6 +43,7 @@ import (
var t, terr = tor.Start(context.Background(), nil)
var tdialer, tderr = t.Dialer(context.TODO(), nil)
// Dial either a unix socket address, or connect to a remote address over Tor. Always uses Tor.
func Dial(network, addr string) (net.Conn, error) {
if terr != nil {
return nil, terr