diff --git a/cfg/cfg.go b/cfg/cfg.go index fcf6103aa..0ea880d08 100644 --- a/cfg/cfg.go +++ b/cfg/cfg.go @@ -6,10 +6,7 @@ import ( "strings" ) -type Flags struct { - // RawGo will enable the support of arbibrary Go code in templates. - RawGo bool -} +type Flags struct{} var Experiment = parse() @@ -19,7 +16,5 @@ func parse() *Flags { m[strings.ToLower(f)] = true } - return &Flags{ - RawGo: m["rawgo"], - } + return &Flags{} } diff --git a/docs/docs/03-syntax-and-usage/09-raw-go.md b/docs/docs/03-syntax-and-usage/09-raw-go.md index 428e85bf1..56302db02 100644 --- a/docs/docs/03-syntax-and-usage/09-raw-go.md +++ b/docs/docs/03-syntax-and-usage/09-raw-go.md @@ -1,13 +1,5 @@ # Raw Go -:::caution -This page describes functionality that is experimental, not enabled by default, and may change or be removed in future versions. - -To enable this feature run the generation step with the `rawgo` experiment flag: `TEMPL_EXPERIMENT=rawgo templ generate` - -You will also need to set the `TEMPL_EXPERIMENT=rawgo` environment variable at your system level or within your editor to enable LSP behavior. -::: - For some more advanced use cases it may be useful to write Go code statements in your template. Use the `{{ ... }}` syntax for this. diff --git a/parser/v2/format_test.go b/parser/v2/format_test.go index bd96a3e07..3c6ee1eb2 100644 --- a/parser/v2/format_test.go +++ b/parser/v2/format_test.go @@ -5,17 +5,11 @@ import ( "path/filepath" "testing" - "github.com/a-h/templ/cfg" "github.com/google/go-cmp/cmp" "golang.org/x/tools/txtar" ) func TestFormatting(t *testing.T) { - oldFlags := cfg.Experiment - t.Cleanup(func() { - cfg.Experiment = oldFlags - }) - cfg.Experiment.RawGo = true files, _ := filepath.Glob("formattestdata/*.txt") if len(files) == 0 { t.Errorf("no test files found") diff --git a/parser/v2/gocodeparser.go b/parser/v2/gocodeparser.go index 36ca686e9..027bcc45d 100644 --- a/parser/v2/gocodeparser.go +++ b/parser/v2/gocodeparser.go @@ -2,14 +2,10 @@ package parser import ( "github.com/a-h/parse" - "github.com/a-h/templ/cfg" "github.com/a-h/templ/parser/v2/goexpression" ) var goCode = parse.Func(func(pi *parse.Input) (n Node, ok bool, err error) { - if !cfg.Experiment.RawGo { - return - } // Check the prefix first. if _, ok, err = parse.Or(parse.String("{{ "), parse.String("{{")).Parse(pi); err != nil || !ok { return diff --git a/parser/v2/gocodeparser_test.go b/parser/v2/gocodeparser_test.go index 19fada80e..af3bd0455 100644 --- a/parser/v2/gocodeparser_test.go +++ b/parser/v2/gocodeparser_test.go @@ -4,17 +4,10 @@ import ( "testing" "github.com/a-h/parse" - "github.com/a-h/templ/cfg" "github.com/google/go-cmp/cmp" ) func TestGoCodeParser(t *testing.T) { - flagVal := cfg.Experiment.RawGo - cfg.Experiment.RawGo = true - defer func() { - cfg.Experiment.RawGo = flagVal - }() - tests := []struct { name string input string