-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/sqlutil/pg: create package; expand env config; add example relay
- Loading branch information
Showing
14 changed files
with
749 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package build | ||
|
||
import ( | ||
"cmp" | ||
"os" | ||
"runtime/debug" | ||
) | ||
|
||
// Unset is a sentinel value. | ||
const Unset = "unset" | ||
|
||
// Version and Checksum are set at compile time via build arguments. | ||
var ( | ||
// Program is updated to the full main program path if [debug.BuildInfo] is available. | ||
Program = os.Args[0] | ||
// Version is the semantic version of the build or Unset. | ||
Version = Unset | ||
// Checksum is the commit hash of the build or Unset. | ||
Checksum = Unset | ||
ChecksumPrefix = Unset | ||
) | ||
|
||
func init() { | ||
buildInfo, ok := debug.ReadBuildInfo() | ||
if ok { | ||
Program = cmp.Or(buildInfo.Main.Path, Program) | ||
if Version == Unset && buildInfo.Main.Version != "" { | ||
Version = buildInfo.Main.Version | ||
} | ||
if Checksum == Unset && buildInfo.Main.Sum != "" { | ||
Checksum = buildInfo.Main.Sum | ||
} | ||
} | ||
ChecksumPrefix = Checksum[:min(7, len(Checksum))] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.