Skip to content

Commit 442fd71

Browse files
committed
Renaming into cmd and pkg structure.
1 parent 21beaea commit 442fd71

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

main.go renamed to cmd/path-helper/main.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"flag"
55
"fmt"
66
"os"
7+
8+
pathhelper "github.com/otaviof/path-helper/pkg/path-helper"
79
)
810

911
// fatal print out error as a shell comment and exit on error.
@@ -13,7 +15,7 @@ func fatal(err error) {
1315
}
1416

1517
// commandLineParser handle command line flags, display help message.
16-
func commandLineParser(config *Config) {
18+
func commandLineParser(config *pathhelper.Config) {
1719
flag.Usage = func() {
1820
fmt.Printf(`## path-helper
1921
@@ -48,10 +50,10 @@ Command-Line Options:
4850
}
4951

5052
func main() {
51-
config := &Config{}
53+
config := &pathhelper.Config{}
5254
commandLineParser(config)
5355

54-
p := NewPathHelper(config)
56+
p := pathhelper.NewPathHelper(config)
5557
expr, err := p.RenderExpression()
5658
if err != nil {
5759
fatal(err)

config.go renamed to pkg/path-helper/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package pathhelper
22

33
// Config all configuration entries supported by this application.
44
type Config struct {

path_helper.go renamed to pkg/path-helper/path_helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package pathhelper
22

33
import (
44
"fmt"

path_helper_test.go renamed to pkg/path-helper/path_helper_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package pathhelper
22

33
import (
44
"fmt"
@@ -8,7 +8,7 @@ import (
88
)
99

1010
func TestPathHelper(t *testing.T) {
11-
config := &Config{Verbose: true, BaseDir: "./test/paths.d"}
11+
config := &Config{Verbose: true, BaseDir: "../../test/paths.d"}
1212
expectedJoinedPaths := "/a/a/a:/b/b/b:/c/c/c:/d/d/d"
1313

1414
t.Run("without-duplicates", func(t *testing.T) {

utils.go renamed to pkg/path-helper/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package pathhelper
22

33
import (
44
"bufio"

utils_test.go renamed to pkg/path-helper/utils_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package pathhelper
22

33
import (
44
"testing"

0 commit comments

Comments
 (0)