Skip to content
Gx
GitHub

GX8004: code file or line range is missing

gx.CodeFile names a file that does not exist, or a line range that is longer than the file.

Cause

gx.CodeFile names a file that does not exist, or a line range that is longer than the file.

Example

ui/code/Code.gx
package code

props {
  Code gx.Code
}

<pre>{p.Code.Source}</pre>
ui/code/Page.gx
package code

<Code code={gx.CodeFile("content/sample.go", "1-3")} />

gx check reports:

gx check
ui/code/Page.gx:3:13: GX8004: gx.CodeFile cannot read content/sample.go

Fix

  1. Correct the path. The path starts at the module root.
  2. Correct the line range.