fix lint errors

Signed-off-by: Tony Worm <tony@hofstadter.io>
This commit is contained in:
Tony Worm 2021-03-15 08:44:49 -04:00 committed by Solomon Hykes
parent 0e32bc68f8
commit b1b534992a
2 changed files with 37 additions and 39 deletions

View File

@ -6,32 +6,32 @@ import (
) )
#Create: { #Create: {
filename: !="" filename: !=""
permissions: int | *0o644 permissions: int | *0o644
contents: string | bytes contents: string | bytes
#compute: [ #compute: [
dagger.#WriteFile & { dest: filename, content: contents, mode: permissions} dagger.#WriteFile & {dest: filename, content: contents, mode: permissions},
] ]
} }
#Append: { #Append: {
filename: !="" filename: !=""
permissions: int | *0o644 permissions: int | *0o644
contents: string | bytes contents: string | bytes
from: dagger.#Artifact from: dagger.#Artifact
orig: (#read & { path: filename, "from": from }).data orig: (#read & {path: filename, "from": from}).data
#compute: [ #compute: [
dagger.#WriteFile & { dest: filename, content: "\(orig)\(contents)", mode: permissions} dagger.#WriteFile & {dest: filename, content: "\(orig)\(contents)", mode: permissions},
] ]
} }
#Read: { #Read: {
filename: !="" filename: !=""
from: dagger.#Artifact from: dagger.#Artifact
contents: (#read & { path: filename, "from": from }).data contents: (#read & {path: filename, "from": from}).data
} }
#read: { #read: {
@ -40,8 +40,8 @@ import (
data: { data: {
string string
#compute: [ #compute: [
dagger.#Load & {"from": from}, dagger.#Load & {"from": from},
dagger.#Export & { source: path } dagger.#Export & {source: path},
] ]
} }
} }
@ -49,8 +49,8 @@ import (
#Glob: { #Glob: {
glob: !="" glob: !=""
filenames: [...string] filenames: [...string]
from: dagger.#Artifact from: dagger.#Artifact
files: (_#glob & { "glob": glob, "from": from }).data files: (_#glob & {"glob": glob, "from": from}).data
// trim suffix because ls always ends with newline // trim suffix because ls always ends with newline
filenames: strings.Split(strings.TrimSuffix(files, "\n"), "\n") filenames: strings.Split(strings.TrimSuffix(files, "\n"), "\n")
} }
@ -66,7 +66,7 @@ _#glob: {
dagger.#Exec & { dagger.#Exec & {
args: ["sh", "-c", "ls \(glob) > \(_tmppath)"] args: ["sh", "-c", "ls \(glob) > \(_tmppath)"]
}, },
dagger.#Export & { source: _tmppath } dagger.#Export & {source: _tmppath},
] ]
} }
} }

View File

@ -21,8 +21,8 @@ TestCreate: {
"sh", "sh",
"-ec", "-ec",
""" """
test "$(cat /file.txt)" = "hello world" test "$(cat /file.txt)" = "hello world"
""", """,
] ]
mount: "/file.txt": { mount: "/file.txt": {
from: write from: write
@ -35,7 +35,7 @@ TestCreate: {
TestRead: { TestRead: {
read: file.#Read & { read: file.#Read & {
filename: "/etc/alpine-release" filename: "/etc/alpine-release"
from: alpine.#Image & { version: "3.10.6" } from: alpine.#Image & {version: "3.10.6"}
} }
test: #compute: [ test: #compute: [
dagger.#Load & {from: alpine.#Image}, dagger.#Load & {from: alpine.#Image},
@ -60,7 +60,7 @@ TestRead2: {
read: file.#Read & { read: file.#Read & {
filename: "/file.txt" filename: "/file.txt"
from: write from: write
} }
test: #compute: [ test: #compute: [
@ -88,14 +88,14 @@ TestAppend: {
append: file.#Append & { append: file.#Append & {
filename: "/file.txt" filename: "/file.txt"
contents: content2 contents: content2
from: write from: write
} }
orig: append.orig orig: append.orig
read: file.#Read & { read: file.#Read & {
filename: "/file.txt" filename: "/file.txt"
from: append from: append
} }
new: read.contents new: read.contents
@ -103,20 +103,20 @@ TestAppend: {
test: new & "hello worldfoo bar" test: new & "hello worldfoo bar"
//test: #compute: [ //test: #compute: [
//dagger.#Load & {from: alpine.#Image}, //dagger.#Load & {from: alpine.#Image},
//dagger.#Exec & { //dagger.#Exec & {
//args: [ //args: [
//"sh", //"sh",
//"-ec", //"-ec",
//""" //"""
//test "$(cat /file.txt)" = "hello worldfoo bar" //test "$(cat /file.txt)" = "hello worldfoo bar"
//""", //""",
//] //]
//mount: "/file.txt": { //mount: "/file.txt": {
//from: append //from: append
//path: "/file.txt" //path: "/file.txt"
//} //}
//}, //},
//] //]
} }
@ -127,5 +127,3 @@ TestGlob: {
} }
test: list.filenames & ["/etc/resolv.conf"] test: list.filenames & ["/etc/resolv.conf"]
} }