Skip to content

Instantly share code, notes, and snippets.

@mayooot
Created June 18, 2025 11:04
Show Gist options
  • Save mayooot/c195cc9fee0e5f801cb4b916347cc532 to your computer and use it in GitHub Desktop.
Save mayooot/c195cc9fee0e5f801cb4b916347cc532 to your computer and use it in GitHub Desktop.
Matching the "connection refused" error
package main
import (
"net/http"
"syscall"
"github.com/pkg/errors"
)
func main() {
_, err := http.Get("localhost:8080")
if errors.Is(err, syscall.ECONNREFUSED) {
panic(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment