Skip to content

Commit

Permalink
only go mod
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenquan Xing committed Jul 30, 2019
1 parent 0577590 commit ac3e699
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions cmd/tools/copyright/licensegen.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
package main

import (
"bufio"
"flag"
"fmt"
"io"
Expand Down Expand Up @@ -90,10 +89,7 @@ func (task *addLicenseHeaderTask) run() error {
return fmt.Errorf("error reading license file, errr=%v", err.Error())
}

task.license, err = commentOutLines(string(data))
if err != nil {
return fmt.Errorf("copyright header check failed, err=%v", err.Error())
}
task.license = string(data)

err = filepath.Walk(task.config.rootDir, task.handleFile)
if err != nil {
Expand Down Expand Up @@ -173,16 +169,3 @@ func mustProcessPath(path string) bool {
func isEOF(err error) bool {
return err == io.EOF || err == io.ErrUnexpectedEOF
}

func commentOutLines(str string) (string, error) {
var lines []string
scanner := bufio.NewScanner(strings.NewReader(str))
for scanner.Scan() {
lines = append(lines, "// "+scanner.Text()+"\n")
}

if err := scanner.Err(); err != nil {
return "", err
}
return strings.Join(lines, ""), nil
}

0 comments on commit ac3e699

Please sign in to comment.