Answer the question
In order to leave comments, you need to log in
Golang function trigger via command cli?
Hello, tell me please, I can’t find anything on the topic, there is a code
package main
import (
"encoding/json"
"flag"
"fmt"
}
func main() {
textPtr := flag.String("")
check()
}
func check() {
функция что-то делает и ничего не возвращает
}
Answer the question
In order to leave comments, you need to log in
As far as I understand, there is a simple solution (for a limited number of called functions) and a complex one (with dynamic function calls).
Simple solution (on the forehead):
import "os"
func main() {
if len(os.Args) > 1 {
if os.Args[1] == "--check" {
check()
}
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question