From 8406b9909392ecfac5f6fcd5b5a7aa6416b40a8d Mon Sep 17 00:00:00 2001 From: bashbunni Date: Wed, 4 Dec 2024 16:13:07 -0800 Subject: [PATCH] wip: ci should fail?? --- glow_test.go | 3 +-- main.go | 19 +++++++++---------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/glow_test.go b/glow_test.go index 5c37a994..c8a5dc8f 100644 --- a/glow_test.go +++ b/glow_test.go @@ -26,9 +26,8 @@ func TestGlowSources(t *testing.T) { if errors.As(err, &urlErr) { t.Logf("Error during execution (args: %s):\n%v", v, err) t.Skip("Test uses network. Are you connected to the Internet?") - } else { - t.Errorf("Error during execution (args: %s): %T %v", v, err, err) } + t.Errorf("Error during execution (args: %s): %T %v", v, err, err) if buf.Len() == 0 { t.Errorf("Output buffer should not be empty (args: %s)", v) diff --git a/main.go b/main.go index 38aafa76..9a57a6d2 100644 --- a/main.go +++ b/main.go @@ -5,7 +5,6 @@ import ( "fmt" "io" "io/fs" - "net" "net/http" "net/url" "os" @@ -76,19 +75,19 @@ func sourceFromArg(arg string) (*source, error) { } // a GitHub or GitLab URL (even without the protocol): - var dnsErr *net.DNSError - var opErr *net.OpError src, err := readmeURL(arg) if err != nil { return src, err } - if src != nil && err == nil { - // if there's an error, try next methods... - return src, nil - } else if err != nil && errors.As(err, &dnsErr) || errors.As(err, &opErr) { - // fail if there's a network error. - return src, err - } + + // var dnsErr *net.DNSError + // if src != nil && err == nil { + // // if there's an error, try next methods... + // return src, nil + // } else if errors.As(err, &dnsErr) { + // // fail if there's a network error. + // return src, err + // } // HTTP(S) URLs: if u, err := url.ParseRequestURI(arg); err == nil && strings.Contains(arg, "://") {