diff --git a/.github/config-schema.json b/.github/config-schema.json index f6cf1dbd..f4aa97a4 100644 --- a/.github/config-schema.json +++ b/.github/config-schema.json @@ -556,6 +556,7 @@ "detect_files": [ "go.mod", "go.sum", + "go.work", "glide.yaml", "Gopkg.yml", "Gopkg.lock", @@ -2797,6 +2798,7 @@ "default": [ "go.mod", "go.sum", + "go.work", "glide.yaml", "Gopkg.yml", "Gopkg.lock", diff --git a/docs/config/README.md b/docs/config/README.md index 3d9be60d..f1e23819 100644 --- a/docs/config/README.md +++ b/docs/config/README.md @@ -1687,6 +1687,7 @@ By default the module will be shown if any of the following conditions are met: - The current directory contains a `go.mod` file - The current directory contains a `go.sum` file +- The current directory contains a `go.work` file - The current directory contains a `glide.yaml` file - The current directory contains a `Gopkg.yml` file - The current directory contains a `Gopkg.lock` file @@ -1696,16 +1697,16 @@ By default the module will be shown if any of the following conditions are met: ### Options -| Option | Default | Description | -| ------------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------- | -| `format` | `"via [$symbol($version )]($style)"` | The format for the module. | -| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` | -| `symbol` | `"🐹 "` | A format string representing the symbol of Go. | -| `detect_extensions` | `["go"]` | Which extensions should trigger this module. | -| `detect_files` | `["go.mod", "go.sum", "glide.yaml", "Gopkg.yml", "Gopkg.lock", ".go-version"]` | Which filenames should trigger this module. | -| `detect_folders` | `["Godeps"]` | Which folders should trigger this module. | -| `style` | `"bold cyan"` | The style for the module. | -| `disabled` | `false` | Disables the `golang` module. | +| Option | Default | Description | +| ------------------- | ----------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| `format` | `"via [$symbol($version )]($style)"` | The format for the module. | +| `version_format` | `"v${raw}"` | The version format. Available vars are `raw`, `major`, `minor`, & `patch` | +| `symbol` | `"🐹 "` | A format string representing the symbol of Go. | +| `detect_extensions` | `["go"]` | Which extensions should trigger this module. | +| `detect_files` | `["go.mod", "go.sum", "go.work", "glide.yaml", "Gopkg.yml", "Gopkg.lock", ".go-version"]` | Which filenames should trigger this module. | +| `detect_folders` | `["Godeps"]` | Which folders should trigger this module. | +| `style` | `"bold cyan"` | The style for the module. | +| `disabled` | `false` | Disables the `golang` module. | ### Variables diff --git a/src/configs/go.rs b/src/configs/go.rs index 2ad34f61..b0ff2532 100644 --- a/src/configs/go.rs +++ b/src/configs/go.rs @@ -26,6 +26,7 @@ impl<'a> Default for GoConfig<'a> { detect_files: vec![ "go.mod", "go.sum", + "go.work", "glide.yaml", "Gopkg.yml", "Gopkg.lock", diff --git a/src/modules/golang.rs b/src/modules/golang.rs index 7e2524b7..c623e2b3 100644 --- a/src/modules/golang.rs +++ b/src/modules/golang.rs @@ -129,6 +129,18 @@ mod tests { dir.close() } + #[test] + fn folder_with_go_work() -> io::Result<()> { + let dir = tempfile::tempdir()?; + File::create(dir.path().join("go.work"))?.sync_all()?; + + let actual = ModuleRenderer::new("golang").path(dir.path()).collect(); + + let expected = Some(format!("via {}", Color::Cyan.bold().paint("🐹 v1.12.1 "))); + assert_eq!(expected, actual); + dir.close() + } + #[test] fn folder_with_godeps() -> io::Result<()> { let dir = tempfile::tempdir()?;