Skip to content
Discussion options

You must be logged in to vote

kron6876 has helped me in official discord sarver.

here is his/her solution:

Wails runs it first (where it first panics) without args then does args on it. There might be an easier way but one solution is to use go build constraints to see if you're in production or dev modes.

Create two files, call them what you want:

  1. utils_production.go
//go:build production

package main

func IsProduction() bool {
    return true
}
  1. utils_notproduction.go
//go:build !production

package main

func IsProduction() bool {
    return false
}

Now from within your main(), use IsProduction():

fmt.Println("IsProduction:", IsProduction())
fmt.Println("len args:", len(os.Args))
fmt.Println(os.Args)

if IsPr…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by EaGitro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant