From 1b0f0839e0ebfcb5d3bfa07518a7f5da5c585fc7 Mon Sep 17 00:00:00 2001 From: jwillp Date: Thu, 29 Aug 2024 01:46:38 -0400 Subject: [PATCH] Check that *FileArtifact implements Artifact at compile time --- fileartifactprocessor.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fileartifactprocessor.go b/fileartifactprocessor.go index 4575421..7c393ae 100644 --- a/fileartifactprocessor.go +++ b/fileartifactprocessor.go @@ -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 { @@ -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 }