Skip to content

Commit

Permalink
Check that *FileArtifact implements Artifact at compile time
Browse files Browse the repository at this point in the history
  • Loading branch information
jwillp committed Aug 29, 2024
1 parent 0b8b26e commit 1b0f083
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions fileartifactprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const (

const DefaultWriteMode WriteMode = WriteOnceMode

var _ Artifact = (*FileArtifact)(nil)

// FileArtifact is a data structure that can be used by a SpecificationProcessor to generate file artifacts
// that can be written by the FileArtifactProcessor.
type FileArtifact struct {
Expand All @@ -54,11 +56,11 @@ func NewDirectoryArtifact(path string, fileMode os.FileMode, writeMode WriteMode
}
}

func (a FileArtifact) ID() ArtifactID {
func (a *FileArtifact) ID() ArtifactID {
return ArtifactID(a.Path)
}

func (a FileArtifact) IsDir() bool {
func (a *FileArtifact) IsDir() bool {
return a.FileMode&os.ModeDir != 0
}

Expand Down

0 comments on commit 1b0f083

Please sign in to comment.