What is the problem:
I would like to declare a constant from a variable. Here is a very simple version of what I'd like to do:
someVar := 1
const someConst = someVar // error: const initializer someVar is not a constant
fmt.Printf("%d %d", someVar, someConst)
How can I make someConst a constant? Is this impossible in go?
Why do I want this?
someVar is a global Variable. It is fine that this can change. someConst is function scoped. For the scope of this function it should not change.
In DB terms: someConst is an immutable snapshot of someVar