Skip to content

Instantly share code, notes, and snippets.

@iporsut
Created June 8, 2011 11:47
Show Gist options
  • Save iporsut/1014275 to your computer and use it in GitHub Desktop.
Save iporsut/1014275 to your computer and use it in GitHub Desktop.
line count
package main
import (
"os"
"fmt"
"io/ioutil"
"strings"
)
func main() {
if (len(os.Args) > 1) {
fileContent, _ := ioutil.ReadFile(os.Args[1])
content := string(fileContent)
lineCount := strings.Count(content,"\n")
fmt.Println(lineCount)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment