linter: ensure make generate is up to date

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
This commit is contained in:
Andrea Luzzardi 2021-01-08 17:29:06 +01:00
parent 4ffcdbf359
commit 2dfe2fccbe
2 changed files with 27 additions and 28 deletions

View File

@ -3,7 +3,7 @@ all: dagger
.PHONY: generate .PHONY: generate
generate: generate:
go generate ./dagger @go generate ./dagger
.PHONY: dagger .PHONY: dagger
dagger: generate dagger: generate
@ -11,9 +11,10 @@ dagger: generate
.PHONY: cuefmt .PHONY: cuefmt
cuefmt: cuefmt:
(cd ./dagger && cue fmt -s ./... && cue trim -s ./...) @(cd ./dagger && cue fmt -s ./... && cue trim -s ./...)
.PHONY: lint .PHONY: lint
lint: lint: generate cuefmt
golangci-lint run golangci-lint run
@test -z "$$(git status -s . | grep -e "^ M" | grep .cue | cut -d ' ' -f3 | tee /dev/stderr)" @test -z "$$(git status -s . | grep -e "^ M" | grep .cue | cut -d ' ' -f3 | tee /dev/stderr)"
@test -z "$$(git status -s . | grep -e "^ M" | grep gen.go | cut -d ' ' -f3 | tee /dev/stderr)"

View File

@ -15,14 +15,14 @@ package dagger
// The DAG architecture has many benefits: // The DAG architecture has many benefits:
// - Because DAGs are made of nodes executing in parallel, they are easy to scale. // - Because DAGs are made of nodes executing in parallel, they are easy to scale.
// - Because all inputs and outputs are snapshotted and content-addressed, DAGs // - Because all inputs and outputs are snapshotted and content-addressed, DAGs
// can easily be made repeatable, can be cached aggressively, and can be replayed // can easily be made repeatable, can be cached aggressively, and can be replayed
// at will. // at will.
// - Because nodes are executed by the same container engine as docker-build, DAGs // - Because nodes are executed by the same container engine as docker-build, DAGs
// can be developed using any language or technology capable of running in a docker. // can be developed using any language or technology capable of running in a docker.
// Dockerfiles and docker images are natively supported for maximum compatibility. // Dockerfiles and docker images are natively supported for maximum compatibility.
// //
// - Because DAGs are programmed declaratively with a powerful configuration language, // - Because DAGs are programmed declaratively with a powerful configuration language,
// they are much easier to test, debug and refactor than traditional programming languages. // they are much easier to test, debug and refactor than traditional programming languages.
// //
// To execute a DAG, the dagger runtime JIT-compiles it to a low-level format called // To execute a DAG, the dagger runtime JIT-compiles it to a low-level format called
// llb, and executes it with buildkit. // llb, and executes it with buildkit.
@ -47,11 +47,9 @@ package dagger
// The contents of a #dagger annotation // The contents of a #dagger annotation
#ComponentConfig: { #ComponentConfig: {
// script to compute the value // script to compute the value
compute?: #Script compute?: #Script
} }
// Any component can be referenced as a directory, since // Any component can be referenced as a directory, since
// every dagger script outputs a filesystem state (aka a directory) // every dagger script outputs a filesystem state (aka a directory)
#Dir: #Component #Dir: #Component
@ -66,19 +64,19 @@ package dagger
do: "export" do: "export"
// Source path in the container // Source path in the container
source: string source: string
format: "json"|"yaml"|*"string"|"number"|"boolean" format: "json" | "yaml" | *"string" | "number" | "boolean"
} }
#Local: { #Local: {
do: "local" do: "local"
dir: string dir: string
include?: [...string] | *[] include?: [...string] | *[]
} }
// FIXME: bring back load (more efficient than copy) // FIXME: bring back load (more efficient than copy)
#Load: { #Load: {
do: "load" do: "load"
from: #Component | #Script from: #Component | #Script
} }
@ -87,41 +85,41 @@ package dagger
args: [...string] args: [...string]
env?: [string]: string env?: [string]: string
always?: true | *false always?: true | *false
dir: string | *"/" dir: string | *"/"
mount?: [string]: #MountTmp | #MountCache | #MountComponent | #MountScript mount?: [string]: #MountTmp | #MountCache | #MountComponent | #MountScript
} }
#MountTmp: "tmpfs" #MountTmp: "tmpfs"
#MountCache: "cache" #MountCache: "cache"
#MountComponent: { #MountComponent: {
input: #Component input: #Component
path: string | *"/" path: string | *"/"
} }
#MountScript: { #MountScript: {
input: #Script input: #Script
path: string | *"/" path: string | *"/"
} }
#FetchContainer: { #FetchContainer: {
do: "fetch-container" do: "fetch-container"
ref: string ref: string
} }
#FetchGit: { #FetchGit: {
do: "fetch-git" do: "fetch-git"
remote: string remote: string
ref: string ref: string
} }
#Copy: { #Copy: {
do: "copy" do: "copy"
from: #Script | #Component from: #Script | #Component
src?: string | *"/" src?: string | *"/"
dest?: string | *"/" dest?: string | *"/"
} }
#TestScript: #Script & [ #TestScript: #Script & [
{ do: "fetch-container", ref: "alpine:latest" }, {do: "fetch-container", ref: "alpine:latest"},
{ do: "exec", args: ["echo", "hello", "world" ] } {do: "exec", args: ["echo", "hello", "world"]},
] ]
` `