Skip to content

Instantly share code, notes, and snippets.

@vlebedev
Last active August 29, 2015 14:02
Show Gist options
  • Save vlebedev/fe33288b062365219ce4 to your computer and use it in GitHub Desktop.
Save vlebedev/fe33288b062365219ce4 to your computer and use it in GitHub Desktop.
import "flag"
// Define flags
var (
httpPort = flag.Int("http_port", 4762, "HTTP localhost admin port.")
configDir = flag.String("config_dir", "/etc/runsit", "Directory containing per-task *.json config files.")
)
// Use them
func main() {
flag.Parse()
ln, err := net.Listen("tcp", fmt.Sprintf("%s:%d", listenAddr, *httpPort))
if err != nil {
logger.Printf("Error listening on port %d: %v", *httpPort, err)
os.Exit(1)
return
}
logger.Printf("Listening on port %d", *httpPort)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment