Skip to content

Commit

Permalink
fix go mod read (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lazar955 authored Nov 6, 2024
1 parent 9174fd9 commit 7b5bba9
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions lib/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,13 @@ import (

// GetBabylonVersion returns babylond version from go.mod
func GetBabylonVersion() (string, error) {
dir, err := os.Getwd()
if err != nil {
fmt.Println("Error:", err)

}

fmt.Println("Current working directory:", dir)
goModPaths := []string{filepath.Join("go.mod"), filepath.Join("..", "go.mod")}

var data []byte
for _, goModPath := range goModPaths {
data, err = os.ReadFile(goModPath)
if err != nil {
continue
data, _ = os.ReadFile(goModPath)
if data != nil {
break
}
}

Expand Down

0 comments on commit 7b5bba9

Please sign in to comment.