Add windows support (#548)

* update  build tags, ui support, and stereoscope, and release for windows support

Signed-off-by: Christopher Angelo Phillips <christopher.phillips@anchore.com>
This commit is contained in:
Christopher Angelo Phillips
2021-10-21 12:49:36 -04:00
committed by GitHub
parent 560b05c2c9
commit 10fa8dc7c9
13 changed files with 97 additions and 28 deletions
+21
View File
@@ -0,0 +1,21 @@
//go:build linux || darwin
// +build linux darwin
package source
import (
"os"
"syscall"
)
// GetXid is the UID GID system info for unix
func GetXid(info os.FileInfo) (uid, gid int) {
uid = -1
gid = -1
if stat, ok := info.Sys().(*syscall.Stat_t); ok {
uid = int(stat.Uid)
gid = int(stat.Gid)
}
return uid, gid
}
+13
View File
@@ -0,0 +1,13 @@
//go:build windows
// +build windows
package source
import (
"os"
)
// GetXid is a placeholder for windows file information
func GetXid(info os.FileInfo) (uid, gid int) {
return -1, -1
}
+1 -7
View File
@@ -2,7 +2,6 @@ package source
import (
"os"
"syscall"
"github.com/anchore/syft/internal/log"
@@ -39,12 +38,7 @@ func fileMetadataByLocation(img *image.Image, location Location) (FileMetadata,
}
func fileMetadataFromPath(path string, info os.FileInfo) FileMetadata {
uid := -1
gid := -1
if stat, ok := info.Sys().(*syscall.Stat_t); ok {
uid = int(stat.Uid)
gid = int(stat.Gid)
}
uid, gid := GetXid(info)
f, err := os.Open(path)
if err != nil {