Go: switch challenge structs to non-pointers

This commit is contained in:
akp 2021-11-27 13:57:12 +00:00
parent 9d2310ca08
commit 624ca0b6e1
No known key found for this signature in database
GPG key ID: AA5726202C8879B7
2 changed files with 6 additions and 6 deletions

View file

@ -4,14 +4,14 @@ import "errors"
type BaseChallenge struct{}
func (b *BaseChallenge) One(instr string) (interface{}, error) {
func (b BaseChallenge) One(instr string) (interface{}, error) {
return nil, errors.New("not implemented")
}
func (b *BaseChallenge) Two(instr string) (interface{}, error) {
func (b BaseChallenge) Two(instr string) (interface{}, error) {
return nil, errors.New("not implemented")
}
func (b *BaseChallenge) Vis(instr string, outdir string) error {
func (b BaseChallenge) Vis(instr string, outdir string) error {
return errors.New("not implemented")
}

View file

@ -46,15 +46,15 @@ func run() error {
switch task.Part {
case runners.PartOne:
run = func() (interface{}, error) {
return (&chcode.Challenge{}).One(task.Input)
return (chcode.Challenge{}).One(task.Input)
}
case runners.PartTwo:
run = func() (interface{}, error) {
return (&chcode.Challenge{}).Two(task.Input)
return (chcode.Challenge{}).Two(task.Input)
}
case runners.Visualise:
run = func() (interface{}, error) {
return "", (&chcode.Challenge{}).Vis(task.Input, task.OutputDir)
return "", (chcode.Challenge{}).Vis(task.Input, task.OutputDir)
}
}