Skip to content

Commit

Permalink
fixed incorrect db path name in main.go
Browse files Browse the repository at this point in the history
  • Loading branch information
damiensedgwick committed Mar 5, 2024
1 parent b133ab4 commit 1a0365d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions napp.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var (
ErrInvalidName = errors.New("invalid project name")
)

const version = "v0.2.1"
const version = "v0.2.2"

func main() {
args := os.Args[1:]
Expand Down Expand Up @@ -125,7 +125,9 @@ func createProject(projectName string) (bool, error) {
}

func createGoMainFile(projectName string) {
mainGoContent := `package main
envVarName := strings.ReplaceAll(strings.ToUpper(projectName), "-", "_") + "_DB_PATH"

mainGoContent := fmt.Sprintf(`package main
import (
"fmt"
Expand Down Expand Up @@ -162,7 +164,7 @@ func main() {
fmt.Println("error loading godotenv")
}
db = sqlx.MustConnect("sqlite3", os.Getenv("AUTH_DIARIES_DB_PATH"))
db = sqlx.MustConnect("sqlite3", os.Getenv("%s"))
var message string
err = db.Ping()
Expand Down Expand Up @@ -195,7 +197,7 @@ func newPageData(message string) PageData {
Message: message,
}
}
`
`, envVarName)

filePath := filepath.Join(projectName, "cmd", "main.go")

Expand Down

0 comments on commit 1a0365d

Please sign in to comment.