JOJ3/pkg/dummy/dummy.go
张泊明518370910136 27a1e4420e
All checks were successful
continuous-integration/drone/push Build is passing
feat: dummy binary + parser example
2024-03-12 16:22:21 -04:00

27 lines
393 B
Go

package dummy
import (
"fmt"
"log/slog"
)
type Conf struct {
Score int
}
type Result struct {
Score int
Comment string
}
func Run(conf Conf) (res Result, err error) {
if conf.Score < 0 {
slog.Error("dummy negative score", "score", conf.Score)
err = fmt.Errorf("dummy negative score: %d", conf.Score)
return
}
res.Score = conf.Score
res.Comment = "dummy comment"
return
}