Skip to content

Commit

Permalink
Rename constants to make them more idiomatic Go
Browse files Browse the repository at this point in the history
  • Loading branch information
zikani03 committed Dec 11, 2020
1 parent 666a01a commit 368b414
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions groupby.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
)

const (
GROUPBY_VERSION = "0.1.0"
SUBDIRECTORY_INNER = "├──"
SUBDIRECTORY_PIPE = "│"
SUBDIRECTORY_LINK = "└──"
Version = "0.1.0"
SubdirectoryInner = "├──"
SubdirectoryPipe = "│"
SubdirectoryLink = "└──"
)

var (
Expand Down Expand Up @@ -160,7 +160,7 @@ func main() {
flag.Parse()

if version {
fmt.Println("groupby ", GROUPBY_VERSION, " - Group files and directories by the date they were created or modified")
fmt.Println("groupby ", Version, " - Group files and directories by the date they were created or modified")
fmt.Println("By Zikani Nyirenda Mwase ")
os.Exit(0)
}
Expand Down
4 changes: 2 additions & 2 deletions printing_visitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ func (p *PrintingVisitor) Visit(n *Node, depth int) {
}
}

prefix := SUBDIRECTORY_INNER
prefix := SubdirectoryInner
if !n.HasNext() {
prefix = SUBDIRECTORY_LINK
prefix = SubdirectoryLink
}

filename := FileNameByDepth(n.FileName, depth)
Expand Down
2 changes: 1 addition & 1 deletion tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func NewTree(directory string, maxDepth int) *Tree {
year, month, day := GetYMD(directory)
dirPath, err := filepath.Abs(directory)
if err != nil {
log.Fatal(err)
panic(err)
}
return &Tree{
Root: NewNode(dirPath, year, month, day),
Expand Down

0 comments on commit 368b414

Please sign in to comment.