mirror of
				https://github.com/xiaoqidun/goenv.git
				synced 2025-11-03 13:59:37 +08:00 
			
		
		
		
	feat(容器支持): 在linux环境下优先使用podman
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		
							
								
								
									
										14
									
								
								goenv.go
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								goenv.go
									
									
									
									
									
								
							@@ -5,6 +5,7 @@ import (
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"os"
 | 
			
		||||
	"os/exec"
 | 
			
		||||
	"runtime"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
@@ -21,14 +22,21 @@ func main() {
 | 
			
		||||
		Author()
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
	d := &DockerGoEnv{
 | 
			
		||||
	binary := "docker"
 | 
			
		||||
	if runtime.GOOS == "linux" {
 | 
			
		||||
		podman, err := exec.LookPath("podman")
 | 
			
		||||
		if err == nil {
 | 
			
		||||
			binary = podman
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	docker := &DockerGoEnv{
 | 
			
		||||
		Image:        "xiaoqidun/goenv",
 | 
			
		||||
		Binary:       "docker",
 | 
			
		||||
		Binary:       binary,
 | 
			
		||||
		WorkDir:      "/go/src/app",
 | 
			
		||||
		AutoDelete:   true,
 | 
			
		||||
		MountWorkDir: true,
 | 
			
		||||
	}
 | 
			
		||||
	d.Run()
 | 
			
		||||
	docker.Run()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Author() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user