Skip to content

Commit 56ae7b8

Browse files
committed
Move non-API packages to internal
1 parent 64bcf99 commit 56ae7b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+69
-78
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package formatters
1+
package format
22

33
import (
44
"bytes"
55
"fmt"
66
"strings"
77

8-
"github.com/stilvoid/please/common"
8+
"github.com/stilvoid/please/internal"
99
)
1010

1111
func wrapObj(in string) string {
@@ -25,7 +25,7 @@ func formatBashInternal(in interface{}, buf *bytes.Buffer) {
2525

2626
switch v := in.(type) {
2727
case map[string]interface{}:
28-
keys := common.SortedKeys(v)
28+
keys := internal.SortedKeys(v)
2929

3030
buf.WriteByte('(')
3131

@@ -51,8 +51,8 @@ func formatBashInternal(in interface{}, buf *bytes.Buffer) {
5151
}
5252

5353
func formatBash(in interface{}) (string, error) {
54-
in = common.ArraysToMaps(in)
55-
in = common.ForceStringKeys(in)
54+
in = internal.ArraysToMaps(in)
55+
in = internal.ForceStringKeys(in)
5656

5757
var buf bytes.Buffer
5858

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

33
import "testing"
44

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

33
import "testing"
44

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/*
22
Package formatters houses the build-in formatter functions that are registered with please
33
*/
4-
package formatters
4+
package format

formatters/dot.go renamed to format/dot.go

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,13 @@
1-
package formatters
1+
package format
22

33
import (
44
"bytes"
55
"fmt"
6-
"regexp"
76
"strings"
87

9-
"github.com/stilvoid/please/common"
8+
"github.com/stilvoid/please/internal"
109
)
1110

12-
var escapeRe *regexp.Regexp
13-
var newlineRe *regexp.Regexp
14-
15-
func init() {
16-
escapeRe = regexp.MustCompile(`(\\|\")`)
17-
newlineRe = regexp.MustCompile(`\n`)
18-
}
19-
2011
func wrap(in string) string {
2112
out := strings.Replace(in, `\`, `\\`, -1)
2213
out = strings.Replace(out, `"`, `\"`, -1)
@@ -86,7 +77,7 @@ func flatten(in interface{}, parent string, name string, buf *bytes.Buffer) {
8677
}
8778

8879
func formatDot(in interface{}) (string, error) {
89-
in = common.ForceStringKeys(in)
80+
in = internal.ForceStringKeys(in)
9081

9182
var buf bytes.Buffer
9283

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

33
import "testing"
44

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

33
import (
44
"fmt"
@@ -23,7 +23,7 @@ func init() {
2323
func Names() []string {
2424
names := make([]string, 0, len(formatters))
2525

26-
for name, _ := range formatters {
26+
for name := range formatters {
2727
names = append(names, name)
2828
}
2929

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
package formatters
1+
package format
22

33
import (
44
"encoding/json"
55

6-
"github.com/stilvoid/please/common"
6+
"github.com/stilvoid/please/internal"
77
)
88

99
func formatJSON(in interface{}) (string, error) {
10-
in = common.ForceStringKeys(in)
10+
in = internal.ForceStringKeys(in)
1111

1212
bytes, err := json.MarshalIndent(in, "", " ")
1313

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

33
import "testing"
44

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package formatters
1+
package format
22

33
import (
44
"fmt"
55
"net/url"
66

7-
"github.com/stilvoid/please/common"
7+
"github.com/stilvoid/please/internal"
88
)
99

1010
func formatQueryInternal(in interface{}) string {
@@ -37,8 +37,8 @@ func formatQueryInternal(in interface{}) string {
3737
}
3838

3939
func formatQuery(in interface{}) (string, error) {
40-
in = common.ArraysToMaps(in)
41-
in = common.ForceStringKeys(in)
40+
in = internal.ArraysToMaps(in)
41+
in = internal.ForceStringKeys(in)
4242

4343
return formatQueryInternal(in), nil
4444
}

0 commit comments

Comments
 (0)