Skip to content

Commit

Permalink
chore: Use go naming conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
bgins committed Jul 3, 2024
1 parent 9b46635 commit 26e6d05
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ jobs:
echo "Building for ${GOOS}/${GOARCH} with GOOS=$GOOS, GOARCH=$GOARCH"
echo "Excluding CUDA. Use the 'cuda' build tag to include it."
go build -o "build/lilypad-${GOOS}-${GOARCH}-cpu" -v -ldflags="-X 'github.com/lilypad-tech/lilypad/cmd/lilypad.VERSION=${{ needs.release.outputs.tag_name }}' -X 'github.com/lilypad-tech/lilypad/cmd/lilypad.COMMIT_SHA=${{ needs.release.outputs.sha }}'"
go build -o "build/lilypad-${GOOS}-${GOARCH}-cpu" -v -ldflags="-X 'github.com/lilypad-tech/lilypad/cmd/lilypad.version=${{ needs.release.outputs.tag_name }}' -X 'github.com/lilypad-tech/lilypad/cmd/lilypad.commitSHA=${{ needs.release.outputs.sha }}'"
echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- done"
Expand Down Expand Up @@ -206,7 +206,7 @@ jobs:
echo "CUDA_HOME: $CUDA_HOME"
echo "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
go build -o "build/lilypad-${GOOS}-${GOARCH}-gpu" -v -tags cuda -ldflags="-X 'github.com/lilypad-tech/lilypad/cmd/lilypad.VERSION=${{ needs.release.outputs.tag_name }}' -X 'github.com/lilypad-tech/lilypad/cmd/lilypad.COMMIT_SHA=${{ needs.release.outputs.sha }}'"
go build -o "build/lilypad-${GOOS}-${GOARCH}-gpu" -v -tags cuda -ldflags="-X 'github.com/lilypad-tech/lilypad/cmd/lilypad.version=${{ needs.release.outputs.tag_name }}' -X 'github.com/lilypad-tech/lilypad/cmd/lilypad.commitSHA=${{ needs.release.outputs.sha }}'"
echo "-------------- OS: ${GOOS} : Arch: ${GOARCH} ---------- done"
Expand Down
2 changes: 1 addition & 1 deletion cmd/lilypad/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func NewRootCmd() *cobra.Command {
RootCmd := &cobra.Command{
Use: getCommandLineExecutable(),
Short: "Lilypad",
Long: fmt.Sprintf("Lilypad: %s \nCommit: %s \n", VERSION, COMMIT_SHA),
Long: fmt.Sprintf("Lilypad: %s \nCommit: %s \n", version, commitSHA),
}

var network string
Expand Down
4 changes: 2 additions & 2 deletions cmd/lilypad/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ func runJob(cmd *cobra.Command, options jobcreator.JobCreatorOptions) error {
⠀⠀⠀⠀⠀⠈⠙⠛⠛⠘⠛⠋⠁⠀ ⠀⠀⠀ Decentralized Compute Network https://lilypad.tech
`
if VERSION != "" {
header = strings.Replace(header, "v2", VERSION, 1)
if version != "" {
header = strings.Replace(header, "v2", version, 1)
}
c.Print(header)

Expand Down
15 changes: 7 additions & 8 deletions cmd/lilypad/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ import (
"github.com/lilypad-tech/lilypad/pkg/system"
)

var VERSION string
var version string
var commitSHA string

var COMMIT_SHA string

const GO_BINARY_URL = "https://github.com/lilypad-tech/lilypad/releases/"
const goBinaryURL = "https://github.com/lilypad-tech/lilypad/releases/"

func newVersionCmd() *cobra.Command {
options := optionsfactory.NewSolverOptions()
Expand All @@ -37,14 +36,14 @@ func runVersion(cmd *cobra.Command) error {
commandCtx := system.NewCommandContext(cmd)
defer commandCtx.Cleanup()

if VERSION == "" {
fmt.Printf("version not found: download the latest binary from %s", GO_BINARY_URL)
if version == "" {
fmt.Printf("version not found: download the latest binary from %s", goBinaryURL)
// unnecessary help shows up when returned as error, so shortciruting here
return nil
}

fmt.Printf("Lilypad: %s\n", VERSION)
fmt.Printf("Commit: %s\n", COMMIT_SHA)
fmt.Printf("Lilypad: %s\n", version)
fmt.Printf("Commit: %s\n", commitSHA)

// TODO: suggest updating to the latest version if the current version is not the latest version

Expand Down

0 comments on commit 26e6d05

Please sign in to comment.