databricks-cli/libs/template
Pieter Noordhuis ad8e61c739
Fix ability to import the CLI repository as module (#1671)
## Changes

While investigating #1629, I found that Go doesn't allow characters
outside the set documented at
https://pkg.go.dev/golang.org/x/mod/module#CheckFilePath.

To fix this, I changed the relevant test case to create the fixtures it
needs instead of loading it from the `testdata` directory (in
`renderer_test.go`).

Some test cases in `config_test.go` depended on templated paths without
needing to do so. In the process of fixing this, I refactored these
tests slightly to reduce dependencies between them.

This change also adds a test case to ensure that all files in the
repository are allowed to be part of a module (per the earlier
`CheckFilePath` function).

Fixes #1629.

## Tests

I manually confirmed I could import the repository as a Go module.
2024-08-12 14:20:04 +00:00
..
templates Fix non-default project names not working in dbt-sql template (#1500) 2024-07-01 07:52:22 +00:00
testdata Fix ability to import the CLI repository as module (#1671) 2024-08-12 14:20:04 +00:00
config.go Allow unknown properties in the config file for template initialization (#1315) 2024-03-26 13:02:09 +00:00
config_test.go Fix ability to import the CLI repository as module (#1671) 2024-08-12 14:20:04 +00:00
file.go Only treat files with .tmpl extension as templates (#594) 2023-08-01 13:43:27 +00:00
file_test.go Only treat files with .tmpl extension as templates (#594) 2023-08-01 13:43:27 +00:00
helpers.go Add UUID function to bundle template functions (#1612) 2024-07-19 11:38:20 +00:00
helpers_test.go Add UUID function to bundle template functions (#1612) 2024-07-19 11:38:20 +00:00
materialize.go Make dbt-sql and default-sql templates public (#1463) 2024-06-04 08:57:13 +00:00
materialize_test.go Improve error message when path is not a bundle template (#985) 2023-11-22 12:25:16 +00:00
renderer.go Update error checks that use the `os` package to use `errors.Is` (#1461) 2024-06-03 12:39:36 +00:00
renderer_test.go Fix ability to import the CLI repository as module (#1671) 2024-08-12 14:20:04 +00:00