Created
          January 25, 2017 19:43 
        
      - 
      
 - 
        
Save lukehinds/9aadfffd3c763920b6cf73916f08157a to your computer and use it in GitHub Desktop.  
    Simple unix file wrapper in go
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | package main | |
| import ( | |
| "os" | |
| "os/exec" | |
| ) | |
| func main() { | |
| file := "/usr/bin/file" | |
| arg := os.Args[1] | |
| cmd := exec.Command(file, arg) | |
| stdout, err := cmd.Output() | |
| if err != nil { | |
| println(err.Error()) | |
| return | |
| } | |
| print(string(stdout)) | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment