aicoded.dev

E-LINT-003: declared module uses a banned capability

The code of a module that modules: in aicoded.yaml declares is built into the app, so it is checked as well: every package of the module the app's build uses, with the files this build leaves out read for their imports and directives. A package of a declared module may not import os/exec, net, syscall, plugin, unsafe or C, nor crypto/tls or log/syslog, which connect through net, nor go/build or go/importer, which run the go command and the cgo tool, nor any package under net/ other than net/http, net/url, net/mail and net/netip, such as net/smtp, net/rpc or net/http/httputil, nor any package of the framework, runnerproto included; may not start or reach another process with os.StartProcess, os.FindProcess or os.Process and its methods; may not use //go:linkname; may not hold assembly, C or other source that is not Go, nor object files, nor a Go file that the checks cannot parse, which is refused at its first line; may use from net/http only the names that E-LINT-009 allows app code; and may not open a database with sql.Open, sql.OpenDB or sql.Register, nor reach a driver with db.Driver() or conn.Raw, nor use ColumnType.ScanType, nor run SQL with the methods of database/sql that take it, such as QueryContext or ExecContext, whose SQL lint does not see, also through an interface as E-LINT-007 reads it, nor call an interface method that E-LINT-007 cannot tell from one of them; and may not call a function or reach a method or memory through reflect: reflect.NewAt, reflect.Value's Call, CallSlice, Method, MethodByName, Pointer, UnsafeAddr and UnsafePointer, and reflect.Type's Method and MethodByName are refused, also through an interface with the same name and signature; nor may it call a method of the connection, statement, transaction or driver interfaces of database/sql/driver (Driver, DriverContext, Connector, Conn, ConnBeginTx, ConnPrepareContext, Execer, ExecerContext, Queryer, QueryerContext, Stmt, StmtExecContext, StmtQueryContext, Tx, Pinger, SessionResetter and Validator), which would reach the driver that database/sql hides, though importing database/sql/driver stays allowed so a module may implement driver.Valuer. Nor may it use slog.SetDefault, slog.SetLogLoggerLevel or slog.NewLogLogger, which E-LINT-009 refuses in app code since the framework sets up the logger, nor change a package-level variable of the standard library or the framework, such as time.Local, rand.Reader or crc32.IEEETable, by assigning to it or to a part of it, also through * as in *time.Local = ..., with ++ or --, by range, or by taking its address; unlike in app code, a write through a pointer the module holds itself, such as *p = v, is not refused. The rest of reflect and os, and the other standard packages, are allowed in it. The problem names the file as module@version/path:line, the same on every machine.

Fix: remove the module from modules: and go.mod, and use a building block or a module that needs none of these.

Markdown · Source on GitHub · framework f46741f