grim/convey
Clone
Summary
Browse
Changes
Graph
Update to Go 1.21 and use some new helpers
5 months ago, Elliott Sales de Andrade
adb6eb2a7d21
Update to Go 1.21 and use some new helpers
`strings.Cut` was added in 1.18, and `maps`/`slices` in 1.21.
Testing Done:
Ran `go test ./...`
Reviewed at https://reviews.imfreedom.org/r/2870/
package
docker
import
(
"fmt"
log
"github.com/sirupsen/logrus"
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/runtime"
"keep.imfreedom.org/grim/convey/tasks"
"keep.imfreedom.org/grim/convey/yaml"
)
type
Import
struct
{
Files
yaml
.
StringOrSlice
`yaml:"files"`
realImport
*
tasks
.
Import
}
// New creates a new Import task.
func
(
i
*
Import
)
New
()
runtime
.
Task
{
return
&
Import
{}
}
// Valid validates the export task.
func
(
i
*
Import
)
Valid
()
error
{
i
.
realImport
=
&
tasks
.
Import
{
Files
:
i
.
Files
,
}
return
i
.
realImport
.
Valid
()
}
// Execute runs the task.
func
(
i
*
Import
)
Execute
(
name
string
,
logger
*
log
.
Entry
,
env
environment
.
Environment
,
rt
*
runtime
.
Runtime
)
error
{
return
i
.
realImport
.
Execute
(
name
,
logger
,
env
,
rt
)
}
func
(
i
*
Import
)
Deprecated
()
error
{
return
fmt
.
Errorf
(
"docker/import has been deprecated in favor of convey/import since 0.15.0"
)
}