aicoded.dev

E-LINT-001: import not allowed

App code reaches the database, files, mail, settings, secrets, other apps and outside services only through the building blocks, so that the runner can hold the app to its permission list. A Go file of an app may import the app's own packages; the building blocks app, auth, config, filestore, mailer, outbound, rpc, secrets, sqldb, telemetry, web, web/form and web/reactive of aicoded.dev/framework; and these standard packages: bufio, bytes, cmp, container/heap, container/list, context, crypto/hmac, crypto/rand, crypto/sha256, crypto/sha512, crypto/subtle, database/sql, database/sql/driver, encoding, encoding/base32, encoding/base64, encoding/binary, encoding/csv, encoding/hex, encoding/json, encoding/xml, errors, fmt, hash, hash/crc32, hash/fnv, html, io, io/fs, iter, log/slog, maps, math, math/big, math/bits, math/rand/v2, net/http, net/mail, net/url, path, regexp, slices, sort, strconv, strings, sync, sync/atomic, time, unicode, unicode/utf16 and unicode/utf8; and the packages of the third-party modules that modules: in aicoded.yaml declares (E-LINT-002). A database driver or a cloud SDK is such a module: E-LINT-002 refuses it while modules: does not declare it, and E-LINT-003 refuses a declared one that imports net, crypto/tls or another package its page lists. Every other import is refused, such as os, os/exec, net, syscall, reflect, unsafe, log, path/filepath or the framework's runnerproto, manifest or migrate. A path under aicoded.dev/framework must be a package of the framework module itself. A package of the app counts as its own only when ./... holds it: one in a testdata folder, in a folder whose name starts with _ or ., or in a folder that an ignore directive of go.mod names is not read by the checks, so its import is refused; move it to another folder. embed, google.golang.org/protobuf/encoding/protowire and the framework's rpc/wire and web/render are for the files that aicoded generate writes; a file counts as generated only when the generator wrote it, whatever its name or first line. E-LINT-005, E-LINT-006 and E-LINT-009 refuse some names of the allowed packages, such as rpc.Call, sql.Open or http.Get. Test files (_test.go) are not checked.

Fix: remove the import and use a building block or an allowed standard package instead, which aicoded explain E-LINT-001 lists, or move a package of your own to a folder the checks read.

Markdown · Source on GitHub · framework f46741f