Skip to content

Commit 65939c4

Browse files
Merge branch 'main' into round-out-part2
2 parents 623f029 + 2138fa7 commit 65939c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+3047
-2748
lines changed

.github/copilot-instructions.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,57 @@ The project supports creating SQL Server instances using Docker or Podman:
155155
- Use the `internal/localizer` package for localized messages
156156
- Supported languages: Chinese (Simplified/Traditional), English, French, German, Italian, Japanese, Korean, Portuguese (Brazil), Russian, Spanish
157157

158+
### Adding Localizable Strings
159+
160+
When adding user-facing strings to the code, use the `localizer` package:
161+
162+
```go
163+
import "github.com/microsoft/go-sqlcmd/internal/localizer"
164+
165+
// Use localizer.Sprintf for formatted strings
166+
message := localizer.Sprintf("This is a localizable message with %s", value)
167+
168+
// Use localizer.Errorf for localized errors
169+
err := localizer.Errorf("Error: %s failed", operation)
170+
```
171+
172+
Constants that are not user-facing (like environment variable names, command names) should be placed in `internal/localizer/constants.go` and do not need localization.
173+
174+
### Generating Localization Files
175+
176+
After adding new localizable strings, you **must** regenerate the translation catalog files before committing. The build scripts handle this automatically.
177+
178+
#### On Windows
179+
180+
```cmd
181+
build\build.cmd
182+
```
183+
184+
This script:
185+
- Installs `gotext` if not already installed
186+
- Runs `go generate` which executes the gotext command defined in `internal/translations/translations.go`
187+
- Generates/updates the translation catalog in `internal/translations/catalog.go`
188+
- Reports any conflicting localizable strings that need to be fixed
189+
190+
#### On Linux/macOS
191+
192+
Run the following commands manually:
193+
194+
```bash
195+
# Install gotext if not already installed
196+
go install golang.org/x/text/cmd/gotext@latest
197+
198+
# Generate translation files
199+
go generate ./...
200+
```
201+
202+
### Important Notes
203+
204+
- Always run the build script after adding new user-facing strings
205+
- Check the build output for "conflicting localizable strings" warnings and resolve them
206+
- The `SQLCMD_LANG` environment variable controls the runtime language (e.g., `de-de`, `fr-fr`)
207+
- Test your changes with different language settings to ensure proper localization
208+
158209
## Azure Authentication
159210

160211
- Azure AD authentication is supported via the `azidentity` package

.github/workflows/golangci-lint.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,16 @@ jobs:
99
name: lint-pr-changes
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/setup-go@v5
12+
# Pinned to commit SHA for supply chain security (CWE-829)
13+
# Verify: gh api repos/actions/setup-go/git/ref/tags/v6 --jq '.object.sha'
14+
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0
1315
with:
1416
go-version: '1.24'
1517
- uses: actions/checkout@v6
1618
- name: golangci-lint
17-
uses: golangci/golangci-lint-action@v6
19+
# Pinned to commit SHA for supply chain security (CWE-829)
20+
# Verify: gh api repos/golangci/golangci-lint-action/git/ref/tags/v9 --jq '.object.sha'
21+
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.0.0
1822
with:
1923
version: latest
2024
only-new-issues: true

.github/workflows/pr-validation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
steps:
1212
- uses: actions/checkout@v6
1313
- name: Setup go
14-
uses: actions/setup-go@v5
14+
uses: actions/setup-go@v6
1515
with:
1616
go-version: '1.24'
1717
- name: Run tests against Linux SQL

.github/workflows/security.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ jobs:
2727
uses: actions/checkout@v6
2828

2929
- name: Setup Go
30-
uses: actions/setup-go@v5
30+
uses: actions/setup-go@v6
3131
with:
32-
go-version: '1.24'
32+
go-version: '1.24.13'
3333

3434
- name: Install govulncheck
3535
run: go install golang.org/x/vuln/cmd/govulncheck@latest

.pipelines/LocBuild.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ steps:
1919
packageSourceAuth: patAuth
2020
dependencyPackageSource: 'https://pkgs.dev.azure.com/msdata/_packaging/SQLDS_SSMS/nuget/v3/index.json'
2121
patVariable: $(System.AccessToken)
22-
22+
isAutoCompletePrSelected: false
23+
isShouldReusePrSelected: true
2324
- task: PublishPipelineArtifact@1
2425
inputs:
2526
targetPath: '$(Build.ArtifactStagingDirectory)'

NOTICE.md

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,8 @@ SOFTWARE.
587587
## github.com/docker/distribution
588588

589589
* Name: github.com/docker/distribution
590-
* Version: v2.8.2
591-
* License: [Apache-2.0](https://github.com/docker/distribution/blob/v2.8.2/LICENSE)
590+
* Version: v2.8.3
591+
* License: [Apache-2.0](https://github.com/docker/distribution/blob/v2.8.3/LICENSE)
592592

593593
```
594594
Apache License
@@ -5056,6 +5056,61 @@ SUBDIRECTORIES
50565056
50575057
```
50585058

5059+
## github.com/shopspring/decimal
5060+
5061+
* Name: github.com/shopspring/decimal
5062+
* Version: v1.4.0
5063+
* License: [MIT](https://github.com/shopspring/decimal/blob/v1.4.0/LICENSE)
5064+
5065+
```
5066+
The MIT License (MIT)
5067+
5068+
Copyright (c) 2015 Spring, Inc.
5069+
5070+
Permission is hereby granted, free of charge, to any person obtaining a copy
5071+
of this software and associated documentation files (the "Software"), to deal
5072+
in the Software without restriction, including without limitation the rights
5073+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
5074+
copies of the Software, and to permit persons to whom the Software is
5075+
furnished to do so, subject to the following conditions:
5076+
5077+
The above copyright notice and this permission notice shall be included in
5078+
all copies or substantial portions of the Software.
5079+
5080+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5081+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
5082+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
5083+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
5084+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
5085+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
5086+
THE SOFTWARE.
5087+
5088+
- Based on https://github.com/oguzbilgic/fpd, which has the following license:
5089+
"""
5090+
The MIT License (MIT)
5091+
5092+
Copyright (c) 2013 Oguz Bilgic
5093+
5094+
Permission is hereby granted, free of charge, to any person obtaining a copy of
5095+
this software and associated documentation files (the "Software"), to deal in
5096+
the Software without restriction, including without limitation the rights to
5097+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
5098+
the Software, and to permit persons to whom the Software is furnished to do so,
5099+
subject to the following conditions:
5100+
5101+
The above copyright notice and this permission notice shall be included in all
5102+
copies or substantial portions of the Software.
5103+
5104+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5105+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
5106+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
5107+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
5108+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
5109+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5110+
"""
5111+
5112+
```
5113+
50595114
## github.com/spf13/afero
50605115

50615116
* Name: github.com/spf13/afero

go.mod

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,26 @@ go 1.24.0
55
toolchain go1.24.12
66

77
require (
8-
github.com/alecthomas/chroma/v2 v2.5.0
9-
github.com/billgraziano/dpapi v0.4.0
10-
github.com/docker/distribution v2.8.2+incompatible
11-
github.com/docker/docker v28.0.0+incompatible
12-
github.com/docker/go-connections v0.4.0
8+
github.com/alecthomas/chroma/v2 v2.23.1
9+
github.com/billgraziano/dpapi v0.5.0
10+
github.com/distribution/reference v0.6.0
11+
github.com/docker/distribution v2.8.3+incompatible
12+
github.com/docker/docker v28.5.2+incompatible
13+
github.com/docker/go-connections v0.6.0
1314
github.com/golang-sql/sqlexp v0.1.0
1415
github.com/google/uuid v1.6.0
1516
github.com/microsoft/go-mssqldb v1.9.6
16-
github.com/opencontainers/image-spec v1.0.2
17+
github.com/opencontainers/image-spec v1.1.1
1718
github.com/peterh/liner v1.2.2
1819
github.com/pkg/errors v0.9.1
19-
github.com/spf13/cobra v1.6.1
20-
github.com/spf13/pflag v1.0.5
21-
github.com/spf13/viper v1.14.0
22-
github.com/stretchr/testify v1.10.0
20+
github.com/spf13/cobra v1.10.2
21+
github.com/spf13/pflag v1.0.10
22+
github.com/spf13/viper v1.21.0
23+
github.com/stretchr/testify v1.11.1
2324
golang.org/x/sys v0.40.0
2425
golang.org/x/term v0.39.0
2526
golang.org/x/text v0.33.0
26-
golang.org/x/tools v0.40.0
27+
golang.org/x/tools v0.41.0
2728
gopkg.in/yaml.v2 v2.4.0
2829
)
2930

@@ -37,61 +38,61 @@ require (
3738
github.com/Microsoft/go-winio v0.6.2 // indirect
3839
github.com/beorn7/perks v1.0.1 // indirect
3940
github.com/cespare/xxhash/v2 v2.3.0 // indirect
41+
github.com/containerd/errdefs v1.0.0 // indirect
42+
github.com/containerd/errdefs/pkg v0.3.0 // indirect
4043
github.com/containerd/log v0.1.0 // indirect
4144
github.com/davecgh/go-spew v1.1.1 // indirect
42-
github.com/distribution/reference v0.6.0 // indirect
43-
github.com/dlclark/regexp2 v1.4.0 // indirect
45+
github.com/dlclark/regexp2 v1.11.5 // indirect
4446
github.com/docker/go-metrics v0.0.1 // indirect
4547
github.com/docker/go-units v0.5.0 // indirect
4648
github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect
4749
github.com/felixge/httpsnoop v1.0.4 // indirect
48-
github.com/fsnotify/fsnotify v1.6.0 // indirect
50+
github.com/fsnotify/fsnotify v1.9.0 // indirect
4951
github.com/go-logr/logr v1.4.2 // indirect
5052
github.com/go-logr/stdr v1.2.2 // indirect
51-
github.com/gogo/protobuf v1.3.2 // indirect
53+
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
5254
github.com/golang-jwt/jwt/v5 v5.2.2 // indirect
5355
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
5456
github.com/golang/protobuf v1.5.4 // indirect
5557
github.com/gorilla/mux v1.8.1 // indirect
56-
github.com/hashicorp/hcl v1.0.0 // indirect
57-
github.com/inconshreveable/mousetrap v1.0.1 // indirect
58+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
5859
github.com/kylelemons/godebug v1.1.0 // indirect
59-
github.com/magiconair/properties v1.8.6 // indirect
6060
github.com/mattn/go-runewidth v0.0.3 // indirect
6161
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
62-
github.com/mitchellh/mapstructure v1.5.0 // indirect
6362
github.com/moby/docker-image-spec v1.3.1 // indirect
63+
github.com/moby/sys/atomicwriter v0.1.0 // indirect
6464
github.com/moby/term v0.5.2 // indirect
6565
github.com/morikuni/aec v1.0.0 // indirect
6666
github.com/opencontainers/go-digest v1.0.0 // indirect
67-
github.com/pelletier/go-toml v1.9.5 // indirect
68-
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
67+
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
6968
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
7069
github.com/pmezard/go-difflib v1.0.0 // indirect
7170
github.com/prometheus/client_golang v1.11.1 // indirect
7271
github.com/prometheus/client_model v0.2.0 // indirect
7372
github.com/prometheus/common v0.26.0 // indirect
7473
github.com/prometheus/procfs v0.6.0 // indirect
74+
github.com/sagikazarmark/locafero v0.11.0 // indirect
7575
github.com/shopspring/decimal v1.4.0 // indirect
76-
github.com/spf13/afero v1.9.2 // indirect
77-
github.com/spf13/cast v1.5.0 // indirect
78-
github.com/spf13/jwalterweatherman v1.1.0 // indirect
79-
github.com/subosito/gotenv v1.4.1 // indirect
76+
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
77+
github.com/spf13/afero v1.15.0 // indirect
78+
github.com/spf13/cast v1.10.0 // indirect
79+
github.com/subosito/gotenv v1.6.0 // indirect
8080
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
8181
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect
8282
go.opentelemetry.io/otel v1.35.0 // indirect
8383
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 // indirect
8484
go.opentelemetry.io/otel/metric v1.35.0 // indirect
8585
go.opentelemetry.io/otel/trace v1.35.0 // indirect
86+
go.yaml.in/yaml/v3 v3.0.4 // indirect
8687
golang.org/x/crypto v0.47.0 // indirect
8788
golang.org/x/mod v0.32.0 // indirect
8889
golang.org/x/net v0.49.0 // indirect
8990
golang.org/x/sync v0.19.0 // indirect
91+
golang.org/x/time v0.14.0 // indirect
9092
google.golang.org/genproto/googleapis/api v0.0.0-20250425173222-7b384671a197 // indirect
9193
google.golang.org/genproto/googleapis/rpc v0.0.0-20250425173222-7b384671a197 // indirect
9294
google.golang.org/grpc v1.71.1 // indirect
9395
google.golang.org/protobuf v1.36.6 // indirect
94-
gopkg.in/ini.v1 v1.67.0 // indirect
9596
gopkg.in/yaml.v3 v3.0.1 // indirect
9697
gotest.tools/v3 v3.5.2 // indirect
9798
)

0 commit comments

Comments
 (0)