File tree Expand file tree Collapse file tree 1 file changed +5
-29
lines changed Expand file tree Collapse file tree 1 file changed +5
-29
lines changed Original file line number Diff line number Diff line change @@ -46,19 +46,10 @@ func readFile(file string) (string, error) {
46
46
return string (buf ), nil
47
47
}
48
48
49
- func fileExists (fileName string ) ( bool , error ) {
49
+ func fileExists (fileName string ) bool {
50
50
51
51
_ , err := os .Stat (fileName )
52
-
53
- if err == nil {
54
- return true , nil
55
- }
56
-
57
- if os .IsNotExist (err ) {
58
- return false , nil
59
- }
60
-
61
- return true , err
52
+ return ! os .IsNotExist (err )
62
53
}
63
54
64
55
func writeToFile (fileName string , content string ) error {
@@ -87,28 +78,13 @@ func appendToFile(fileName string, content string) error {
87
78
return err
88
79
}
89
80
90
- func linkFile (fileName string , fileTo string ) error {
91
-
92
- exists , err := fileExists (fileTo )
81
+ func linkFile (fileFrom string , fileTo string ) error {
93
82
94
- if err != nil {
95
- return err
96
- }
97
-
98
- if exists {
83
+ if fileExists (fileTo ) {
99
84
return nil
100
85
}
101
86
102
- command := ExecCommand {
103
- Command : "ln" ,
104
- Args : []string {
105
- "-s" ,
106
- fileName ,
107
- fileTo ,
108
- },
109
- }
110
-
111
- return runCommand (command )
87
+ return os .Link (fileFrom , fileTo )
112
88
}
113
89
114
90
func runCommand (execCommad ExecCommand ) error {
You can’t perform that action at this time.
0 commit comments