{"record":{"id":"6c9c829cde40c633","repo":"santifer/career-ops","slug":"opening-urls-is-not-supported-on-s","errorCode":null,"errorMessage":"opening URLs is not supported on %s","messagePattern":"opening URLs is not supported on (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dashboard/open_unsupported.go","lineNumber":11,"sourceCode":"//go:build !windows && !darwin && !linux\n\npackage main\n\nimport (\n\t\"fmt\"\n\t\"runtime\"\n)\n\nfunc openWithDefaultApp(target string) error {\n\treturn fmt.Errorf(\"opening URLs is not supported on %s\", runtime.GOOS)\n}\n","sourceCodeStart":1,"sourceCodeEnd":13,"githubUrl":"https://github.com/santifer/career-ops/blob/60398d6549a46f5266929538af21cfab94badc75/dashboard/open_unsupported.go#L1-L13","documentation":"Compile-time-selected stub in the dashboard Go binary: open_unsupported.go carries the build tag `!windows && !darwin && !linux`, so any other GOOS (freebsd, netbsd, openbsd, plan9, js/wasm, ...) compiles openWithDefaultApp() to an unconditional error naming runtime.GOOS. The project ships real openers only for windows (shell open), darwin (open), and linux (xdg-open).","triggerScenarios":"`GOOS=freebsd go build ./dashboard` (or running a cross-compiled binary) and then clicking/opening a URL that routes to openWithDefaultApp(target). Everything else in the dashboard builds; only browser-opening is stubbed out.","commonSituations":"Packaging the dashboard for a BSD or niche OS; GOOS=js/wasm experiments; CI cross-compilation matrices that build for all platforms without running them.","solutions":["Build/run the dashboard on windows, darwin, or linux — the supported opener set","Add your own build-tagged implementation (e.g. open_bsd.go with xdg-open, which exists on most BSDs) mirroring the linux file","If you control the call site, catch this error and surface the raw URL so the user can open it manually"],"exampleFix":"// before: only open_linux.go / open_darwin.go / open_windows.go exist\n// after: add dashboard/open_bsd.go\n//go:build freebsd || netbsd || openbsd\n\npackage main\n\nimport \"os/exec\"\n\nfunc openWithDefaultApp(target string) error {\n\treturn exec.Command(\"xdg-open\", target).Start()\n}","handlingStrategy":"fallback","validationCode":"switch runtime.GOOS {\ncase \"windows\", \"darwin\", \"linux\":\n    // openWithDefaultApp is safe to call\ndefault:\n    fmt.Printf(\"open manually: %s\\n\", target) // fallback instead of erroring\n}","typeGuard":"func canOpenURLs() bool {\n\tswitch runtime.GOOS {\n\tcase \"windows\", \"darwin\", \"linux\":\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}","tryCatchPattern":"if err := openWithDefaultApp(u); err != nil {\n    if strings.Contains(err.Error(), \"opening URLs is not supported\") {\n        fmt.Printf(\"Open in your browser: %s\\n\", u) // degrade gracefully\n    } else {\n        return err\n    }\n}","preventionTips":["Gate the open-URL feature on runtime.GOOS and always print the URL as fallback","In cross-compile CI, build for all platforms but only smoke-test open on windows/darwin/linux","Adding a new GOOS? Ship a build-tagged open_<goos>.go beside open_unsupported.go"],"tags":["go","cross-platform","build-tags","unsupported-os"],"backgroundTag":"unsupported-platform","analyzedSha":"60398d6549a46f5266929538af21cfab94badc75","analyzedAt":"2026-08-20T23:00:06.764Z","contentChangedAt":"2026-08-20T23:00:06.764Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}