Drew on Nostr: go users, is there any way to change stuff at compiletime, maybe based on flags ...
go users, is there any way to change stuff at compiletime, maybe based on flags passed to go run/build?
something like
//env: dev
abc := 42
//env: prod
abc := 2
So in prod abc will be 2 but while developing abc will be 42
#golang
Published at
2024-11-27 11:15:07Event JSON
{
"id": "f3a1f9d62d6d3947ac410787b6616561dbc4d7cdead3209b18e07df78dd1f865",
"pubkey": "d3cd9922a0975a0af8b7ef486f6ca371f2f8f276910e852c38548a750595929d",
"created_at": 1732706107,
"kind": 1,
"tags": [
[
"t",
"golang"
],
[
"proxy",
"https://hachyderm.io/users/crmsnbleyd/statuses/113554627443994258",
"activitypub"
]
],
"content": "go users, is there any way to change stuff at compiletime, maybe based on flags passed to go run/build?\n\nsomething like\n\n//env: dev\nabc := 42\n\n//env: prod\nabc := 2\n\nSo in prod abc will be 2 but while developing abc will be 42\n\n#golang",
"sig": "b036ceef2925907c74141a002647d3d0f0ab044a1f7f05e41a76a6b1fca245a6c4d6fdcb49086b999a9ef0d55a173812b18992936881d733dd6ee2385cc5d02c"
}