Skip to content

Commit 5f54cc0

Browse files
committed
Snakecase all folders and filenames
Go doesn't have a standardized way of naming files: golang/go#36060 But I'm going with snakecase, since `go test` finds files using the `*_test.go` convention.
1 parent ceb13be commit 5f54cc0

File tree

9 files changed

+14
-14
lines changed

9 files changed

+14
-14
lines changed

chooseYourOwnAdventure/chooseYourOwnAdventure.go renamed to choose_your_own_adventure/choose_your_own_adventure.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package chooseYourOwnAdventure
1+
package choose_your_own_adventure
22

33
import (
44
"encoding/json"
@@ -16,7 +16,7 @@ import (
1616
type ChooseYourOwnAdventure struct{}
1717

1818
func (c *ChooseYourOwnAdventure) CommandName() string {
19-
return "chooseYourOwnAdventure"
19+
return "choose_your_own_adventure"
2020
}
2121

2222
func (c *ChooseYourOwnAdventure) Run(args []string) {
@@ -29,7 +29,7 @@ func (c *ChooseYourOwnAdventure) Run(args []string) {
2929
cmd.Parse(args)
3030

3131
story := parseStory(jsonPath)
32-
html := template.Must(template.ParseFiles("chooseYourOwnAdventure/template.html"))
32+
html := template.Must(template.ParseFiles(fmt.Sprintf("%s/template.html", c.CommandName())))
3333
handler := storyHandler{story: story, template: html}
3434

3535
mux := http.NewServeMux()

link_parser/link_parser.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package linkParser
1+
package link_parser
22

33
import (
44
"flag"
@@ -14,7 +14,7 @@ import (
1414
type LinkParser struct{}
1515

1616
func (l *LinkParser) CommandName() string {
17-
return "linkParser"
17+
return "link_parser"
1818
}
1919

2020
func (l *LinkParser) Run(args []string) {

link_parser/link_parser_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package linkParser
1+
package link_parser
22

33
import (
44
"os"

main.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"fmt"
55
"os"
66

7-
"git.sr.ht/~hwrd/gophercises/chooseYourOwnAdventure"
8-
"git.sr.ht/~hwrd/gophercises/linkParser"
7+
"git.sr.ht/~hwrd/gophercises/choose_your_own_adventure"
8+
"git.sr.ht/~hwrd/gophercises/link_parser"
99
"git.sr.ht/~hwrd/gophercises/quiz"
10-
"git.sr.ht/~hwrd/gophercises/urlShortener"
10+
"git.sr.ht/~hwrd/gophercises/url_shortener"
1111
"git.sr.ht/~hwrd/gophercises/util"
1212
)
1313

@@ -17,10 +17,10 @@ func addSubcommand(m map[string]util.Subcommand, cmd util.Subcommand) {
1717

1818
func main() {
1919
subcommands := make(map[string]util.Subcommand)
20-
addSubcommand(subcommands, &chooseYourOwnAdventure.ChooseYourOwnAdventure{})
21-
addSubcommand(subcommands, &linkParser.LinkParser{})
20+
addSubcommand(subcommands, &choose_your_own_adventure.ChooseYourOwnAdventure{})
21+
addSubcommand(subcommands, &link_parser.LinkParser{})
2222
addSubcommand(subcommands, &quiz.Quiz{})
23-
addSubcommand(subcommands, &urlShortener.URLShortener{})
23+
addSubcommand(subcommands, &url_shortener.URLShortener{})
2424

2525
subcommand := os.Args[1]
2626
if cmd, ok := subcommands[subcommand]; ok {

urlShortener/urlShortener.go renamed to url_shortener/url_shortener.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package urlShortener
1+
package url_shortener
22

33
import (
44
"flag"
@@ -20,7 +20,7 @@ type url struct {
2020
}
2121

2222
func (u *URLShortener) CommandName() string {
23-
return "urlShortener"
23+
return "url_shortener"
2424
}
2525

2626
func (u *URLShortener) Run(args []string) {
Binary file not shown.
File renamed without changes.

0 commit comments

Comments
 (0)