Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

refactor: use constants for OSs #448

Merged
merged 1 commit into from
Sep 28, 2021
Merged

Conversation

greyscaled
Copy link
Contributor

@greyscaled greyscaled commented Sep 24, 2021

@greyscaled greyscaled requested a review from jawnsy September 24, 2021 02:14
@coveralls
Copy link

coveralls commented Sep 24, 2021

Pull Request Test Coverage Report for Build 1268223903

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1 of 3 (33.33%) changed or added relevant lines in 2 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.03%) to 48.014%

Changes Missing Coverage Covered Lines Changed/Added Lines %
internal/cmd/configssh.go 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
wsnet/dial.go 2 78.02%
Totals Coverage Status
Change from base Build 1237802265: -0.03%
Covered Lines: 2816
Relevant Lines: 5865

💛 - Coveralls

@greyscaled greyscaled self-assigned this Sep 24, 2021
@@ -36,6 +36,7 @@ import (
const (
goosWindows = "windows"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's unfortunate that Go doesn't seem to offer these constants in their code anywhere. It looks like Go themselves use hardcoded string comparisons everywhere: https://sourcegraph.com/search?q=context:global+repo:%5Egithub%5C.com/golang/go%24+%22windows%22&patternType=literal -- given that, maybe it's okay for us to do that too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I think that doesn't sit well unless at least a type (like TS union of strings as a type alias) is defined. That feels a bit like walking on quicksand.

I don't know their reason, but I think it's reasonable we reach for them in our own domain model/application code base. I'd expect there to be some concept of a constant, enumeration or type in other languages when approaching a similar problem. Go sometimes makes odd choices IMO :P

@greyscaled greyscaled merged commit 7d34771 into main Sep 28, 2021
@greyscaled greyscaled deleted the vapurrmaid/rfr-os-consts branch September 28, 2021 02:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants