Skip to content

Commit

Permalink
Use proper spelling of license
Browse files Browse the repository at this point in the history
  • Loading branch information
ascandella committed Nov 10, 2016
1 parent 6cce7d6 commit bd985aa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ var (
stdout = flag.Bool("stdout", false, "Write to STDOUT instead of a file")
stdin = flag.Bool("stdin", false, "Read from STDIN instead of a file")
pkgName = flag.String("pkg", "", "Package name. If empty, infer from directory of input")
licence = flag.Bool("licence", true, "Add licence header from file")
licenceFile = flag.String("licenceFile", "LICENSE.txt", "File to read licence header from")
license = flag.Bool("license", true, "Add license header from file")
licenseFile = flag.String("licenseFile", "LICENSE.txt", "File to read license header from")

goListCmd = []string{"list", "-f", "{{.Name}}"}
)
Expand All @@ -60,17 +60,17 @@ func main() {
w := writer()
defer w.Close()

if *licence {
if _, err := os.Stat(*licenceFile); err == nil {
writeLicence(w, *licenceFile)
if *license {
if _, err := os.Stat(*licenseFile); err == nil {
writelicense(w, *licenseFile)
}
}
w.Write(output)
}

func writeLicence(w io.Writer, path string) {
licenceLines := readLicence(*licenceFile)
for _, line := range licenceLines {
func writelicense(w io.Writer, path string) {
licenseLines := readlicense(*licenseFile)
for _, line := range licenseLines {
w.Write([]byte("//"))
if len(line) > 0 {
w.Write([]byte(" "))
Expand All @@ -81,7 +81,7 @@ func writeLicence(w io.Writer, path string) {
w.Write([]byte("\n"))
}

func readLicence(path string) [][]byte {
func readlicense(path string) [][]byte {
fb, err := ioutil.ReadFile(path)
if err != nil {
panic(err)
Expand Down
4 changes: 2 additions & 2 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ func TestWriter_CustomFile(t *testing.T) {
})
}

func TestWriteLicence_OK(t *testing.T) {
defer overrideBool(licence, true)()
func TestWritelicense_OK(t *testing.T) {
defer overrideBool(license, true)()

require.NotPanics(t, main)
contents, err := ioutil.ReadFile("doc.go")
Expand Down

0 comments on commit bd985aa

Please sign in to comment.