mirror of
https://github.com/anchore/syft.git
synced 2026-02-12 18:46:41 +01:00
capitalize file type strings
Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
parent
772613647c
commit
8551168702
@ -1,33 +1,35 @@
|
||||
package source
|
||||
|
||||
import "archive/tar"
|
||||
|
||||
const (
|
||||
UnknownFileType FileType = "unknownFileType"
|
||||
RegularFile FileType = "regularFile"
|
||||
HardLink FileType = "hardLink"
|
||||
SymbolicLink FileType = "symbolicLink"
|
||||
CharacterDevice FileType = "characterDevice"
|
||||
BlockDevice FileType = "blockDevice"
|
||||
Directory FileType = "directory"
|
||||
FIFONode FileType = "fifoNode"
|
||||
UnknownFileType FileType = "UnknownFileType"
|
||||
RegularFile FileType = "RegularFile"
|
||||
HardLink FileType = "HardLink"
|
||||
SymbolicLink FileType = "SymbolicLink"
|
||||
CharacterDevice FileType = "CharacterDevice"
|
||||
BlockDevice FileType = "BlockDevice"
|
||||
Directory FileType = "Directory"
|
||||
FIFONode FileType = "FIFONode"
|
||||
)
|
||||
|
||||
type FileType string
|
||||
|
||||
func newFileTypeFromTarHeaderTypeFlag(flag byte) FileType {
|
||||
switch flag {
|
||||
case '0', '\x00':
|
||||
case tar.TypeReg, tar.TypeRegA:
|
||||
return RegularFile
|
||||
case '1':
|
||||
case tar.TypeLink:
|
||||
return HardLink
|
||||
case '2':
|
||||
case tar.TypeSymlink:
|
||||
return SymbolicLink
|
||||
case '3':
|
||||
case tar.TypeChar:
|
||||
return CharacterDevice
|
||||
case '4':
|
||||
case tar.TypeBlock:
|
||||
return BlockDevice
|
||||
case '5':
|
||||
case tar.TypeDir:
|
||||
return Directory
|
||||
case '6':
|
||||
case tar.TypeFifo:
|
||||
return FIFONode
|
||||
}
|
||||
return UnknownFileType
|
||||
|
||||
@ -26,7 +26,7 @@ func TestPowerUserCmdFlags(t *testing.T) {
|
||||
args: []string{"power-user", request},
|
||||
assertions: []traitAssertion{
|
||||
assertNotInOutput(" command is deprecated"), // only the root command should be deprecated
|
||||
assertInOutput(`"type": "regularFile"`), // proof of file-metadata data
|
||||
assertInOutput(`"type": "RegularFile"`), // proof of file-metadata data
|
||||
assertInOutput(`"algorithm": "sha256"`), // proof of file-metadata default digest algorithm of sha256
|
||||
assertInOutput(`"metadataType": "ApkMetadata"`), // proof of package artifacts data
|
||||
assertSuccessfulReturnCode,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user