On branch read-file-error-check
Changes to be committed: new file: main Perhaps add this to gitignore next time? Is it generally bad form? new file: main.go
This commit is contained in:
parent
173e354269
commit
b4b01a5cf4
21
main.go
Normal file
21
main.go
Normal file
@ -0,0 +1,21 @@
|
||||
package main
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
func check(e error) {
|
||||
if e != nil {
|
||||
panic(e)
|
||||
}
|
||||
}
|
||||
|
||||
func read_connections_file() {
|
||||
var connections_file_path string = "/proc/net/tcp"
|
||||
data, err := ioutil.ReadFile(connections_file_path)
|
||||
check(err)
|
||||
fmt.Println(string(data))
|
||||
}
|
||||
func main() {
|
||||
read_connections_file()
|
||||
}
|
Loading…
Reference in New Issue
Block a user