Repository navigation
all: Add build constants for runtime.GOOS comparisons - #8442
Conversation
|
|
||
| package build | ||
|
|
||
| //go:generate /bin/sh runtimeos.sh |
There was a problem hiding this comment.
Does it need to be though? This requires regeneration Literally Never(tm) :)
There was a problem hiding this comment.
Wouldn't this trip whenever someone just runs go generate in the project?
There was a problem hiding this comment.
If someone did, yes, I guess it would. But then they also need to have all the protobuf tools, the mock generator and whatnot installed. I don't think it's a very common thing for anyone to do on a lark. I mean, I could just remove the generator, the generated constants themselves are trivial and could be hand maintained after the initial generation too...
There was a problem hiding this comment.
Sounds like a better option.
Or have a .sh script you can run adhoc to generate.
There was a problem hiding this comment.
There, generator is gone; shell script remains for provenance or in case we ever want to update.
I grew tired of hand written string comparisons. This adds generated constants for the GOOS values, and predefined Is$OS constants that can be iffed on. In a couple of places I rewrote trivial switch:es to if:s, and added Illumos where we checked for Solaris (because they are effectively the same, and if we're going to target one of them that would be Illumos...).
* main: (22 commits) lib/model: Use bytes.Equal instead of converting to string (syncthing#8469) all: Add build constants for runtime.GOOS comparisons (syncthing#8442) cmd/strelaysrv: Fix superfluous else statements (syncthing#8468) all: Fix nested `if` with `else if` (syncthing#8467) all: Unused errors lib/fs: Consolidate append in test lib/api: Further (final?) unused parameters removal cmd/syncthing: Incorrect error handling lib/api: String comparisons lib/api: Remove unused parameters all: Fix unused method receiver (further) (syncthing#8466) all: Minor deprecation updates lib/model: Clarify normal shallow copy lib/api: Missing error handling in config handler (syncthing#8463) all: Remove unused method receivers (syncthing#8462) all: Combine sequential appends (syncthing#8461) cmd/ursrv: Silence linter with correct regexps (syncthing#8460) all: Unused parameter should be replaced by underscore (syncthing#8464) all: Remove or convert deprecated API usages (syncthing#8459) lib/config: Remove unnecessary use of `fmt.Sprintf` (syncthing#8458) ...
* main: (94 commits) build: bump actions/setup-go from 2.2.0 to 3.2.1 (syncthing#8492) build: Let dependabot suggest updates to GitHub actions (syncthing#8490) update: Go version in update-docs-translations action (syncthing#8489) gui, man, authors: Update docs, translations, and contributors cmd/syncthing: Refactor CLI code to allow passing CLI arguments via function parameter (syncthing#8485) build: Update quic-go for Go 1.19 (syncthing#8483) lib/ur: Properly initialize map in failure data (fixes syncthing#8479) (syncthing#8480) lib/ur: Properly initialize map in failure data (fixes syncthing#8479) gui, man, authors: Update docs, translations, and contributors docs: Clarify docker network mode limitations (syncthing#8472) lib/config: Use net.JoinHostPort instead of string manipulation (syncthing#8470) lib/api: Fix inverted logic in string comparison lib/model: Use bytes.Equal instead of converting to string (syncthing#8469) all: Add build constants for runtime.GOOS comparisons (syncthing#8442) cmd/strelaysrv: Fix superfluous else statements (syncthing#8468) all: Fix nested `if` with `else if` (syncthing#8467) all: Unused errors lib/fs: Consolidate append in test lib/api: Further (final?) unused parameters removal cmd/syncthing: Incorrect error handling ...
* main: (121 commits) gui, api: Show internal config and state paths (fixes syncthing#8323) (syncthing#8324) build(deps): bump github.com/go-ldap/ldap/v3 from 3.4.1 to 3.4.4 (syncthing#8475) build: bump actions/setup-go from 2.2.0 to 3.2.1 (syncthing#8492) build: Let dependabot suggest updates to GitHub actions (syncthing#8490) update: Go version in update-docs-translations action (syncthing#8489) gui, man, authors: Update docs, translations, and contributors cmd/syncthing: Refactor CLI code to allow passing CLI arguments via function parameter (syncthing#8485) build: Update quic-go for Go 1.19 (syncthing#8483) lib/ur: Properly initialize map in failure data (fixes syncthing#8479) (syncthing#8480) lib/ur: Properly initialize map in failure data (fixes syncthing#8479) gui, man, authors: Update docs, translations, and contributors docs: Clarify docker network mode limitations (syncthing#8472) lib/config: Use net.JoinHostPort instead of string manipulation (syncthing#8470) lib/api: Fix inverted logic in string comparison lib/model: Use bytes.Equal instead of converting to string (syncthing#8469) all: Add build constants for runtime.GOOS comparisons (syncthing#8442) cmd/strelaysrv: Fix superfluous else statements (syncthing#8468) all: Fix nested `if` with `else if` (syncthing#8467) all: Unused errors lib/fs: Consolidate append in test ...
I grew tired of hand written string comparisons. This adds generated
constants for the GOOS values, and predefined Is$OS constants that can
be iffed on. In a couple of places I rewrote trivial switch:es to if:s,
and added Illumos where we checked for Solaris (because they are
effectively the same, and if we're going to target one of them that
would be Illumos...).