Files
clio/tools/requests_gun/requests_gun.go
Ayaz Salikhov 424af5dfe0 style: Apply go fmt to go code (#2046)
~I will add pre-commit hook later if I find a good one~

Found a nice repo, but it is no longer maintained:
https://github.com/dnephin/pre-commit-golang
So, I implemented the check as a local hook.
2025-04-28 16:04:50 +01:00

37 lines
652 B
Go

package main
import (
"fmt"
"os"
"requests_gun/internal/ammo_provider"
"requests_gun/internal/parse_args"
"requests_gun/internal/trigger"
)
func main() {
args, err := parse_args.Parse()
if err != nil {
fmt.Fprintln(os.Stderr, "Error: ", err)
parse_args.PrintUsage()
os.Exit(1)
}
if args.Help {
parse_args.PrintUsage()
os.Exit(0)
}
fmt.Print("Loading ammo... ")
f, err := os.Open(args.Ammo)
if err != nil {
fmt.Println("Error opening file '", args.Ammo, "': ", err)
os.Exit(1)
}
ammoProvider := ammo_provider.New(f)
f.Close()
fmt.Println("Done")
fmt.Println("Firing requests...")
trigger.Fire(ammoProvider, args)
}