-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmygo
More file actions
executable file
·48 lines (40 loc) · 691 Bytes
/
mygo
File metadata and controls
executable file
·48 lines (40 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
# argument is nothing
if [ $# = 0 ]; then
echo "Specify file names as arguments."
exit 1
fi
# repeat for argument
for arg in $@
do
if test -e "$arg.go"; then # Do not create $arg.go if it exists
echo "$arg.go already exists."
else
touch $arg.go # make gofile
echo "package main
import (
"bufio"
"fmt"
"os"
"strconv"
)
var sc = bufio.NewScanner(os.Stdin)
var wtr = bufio.NewWriter(os.Stdout)
func nextInt() int {
sc.Scan()
i, e := strconv.Atoi(sc.Text())
if e != nil {
panic(e)
}
return i
}
func nextLine() string {
sc.Scan()
return sc.Text()
}
func main() {
//sc.Split(bufio.ScanWords)
}
" > $arg.go
fi
done