-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #120 from Peefy/update-go-lib-repo
refactor: move go files to the go folder
- Loading branch information
Showing
48 changed files
with
155 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
!lib/**/*.dylib | ||
!lib/**/*.dll | ||
!lib/**/*.lib | ||
!lib/**/*.so | ||
!lib/**/*.exe |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package install | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
"runtime" | ||
) | ||
|
||
func installBin(binDir, binName string, content []byte, versionMatched bool) error { | ||
binPath := findPath(binName) | ||
if binPath == "" || !versionMatched { | ||
if runtime.GOOS == "windows" { | ||
binName += ".exe" | ||
} | ||
binPath = filepath.Join(binDir, binName) | ||
err := os.MkdirAll(binDir, 0777) | ||
if err != nil { | ||
return err | ||
} | ||
binFile, err := os.Create(binPath) | ||
defer func() { | ||
binFile.Close() | ||
}() | ||
if err != nil { | ||
return err | ||
} | ||
_, err = binFile.Write(content) | ||
if err != nil { | ||
return err | ||
} | ||
fileMode := os.FileMode(0777) | ||
os.Chmod(binPath, fileMode) | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package install | ||
|
||
import lib "kcl-lang.io/lib/go/lib" | ||
|
||
func installLib(libDir, libName string, versionMatched bool) error { | ||
libFullName := libName + ".dll" | ||
exportLibFullName := libName + ".lib" | ||
err := writeLib(libDir, libFullName, lib.CliLib, versionMatched) | ||
if err != nil { | ||
return err | ||
} | ||
return writeLib(libDir, exportLibFullName, lib.ExportLib, versionMatched) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
//go:build linux || darwin | ||
// +build linux darwin | ||
|
||
package lib | ||
package install | ||
|
||
import ( | ||
"fmt" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package lib | ||
package install | ||
|
||
import ( | ||
"os" | ||
|
Oops, something went wrong.