golang的私有化定制自动更新插件
zanbin168
2023-05-16 93e47518a430c1b33cd962d071e30794ad1d3ae4
update
1个文件已修改
9 ■■■■ 已修改文件
update.go 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
update.go
@@ -103,12 +103,17 @@
// Install binary to replace the current version.
func (m *Manager) Install(path string) error {
    bin, err := os.Executable()
    executablePath, err := os.Executable()
    if err != nil {
        return errors.Wrapf(err, "looking up path of %q", m.Command)
    }
    absolutePath, err := filepath.Abs(executablePath)
    if err != nil {
        return errors.Wrapf(err, "looking up path of %q", m.Command)
    }
    dir := filepath.Dir(bin)
    dir := strings.TrimSuffix(absolutePath, "/"+m.Command)
    return m.InstallTo(path, dir)
}