Fix 6 bugs in hand-written files, templates, and build scripts#123
Open
luke-hagar-sp wants to merge 1 commit intomainfrom
Open
Fix 6 bugs in hand-written files, templates, and build scripts#123luke-hagar-sp wants to merge 1 commit intomainfrom
luke-hagar-sp wants to merge 1 commit intomainfrom
Conversation
- Fix wrong error variable in localConfig() and homeConfig() (err -> err2)
- Fix global viper instance pollution between localConfig() and homeConfig()
- Remove unused jsonCheck/xmlCheck vars, dead service struct, and regexp import
- Fix generated test template to pass required ClientConfiguration arg
- Add missing await to fs.unlink() and fs.writeFile() in postscript.js
- Replace broken fs.stat() check with fs.mkdir({ recursive: true })
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
philip-ellis-sp
approved these changes
Apr 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cross-SDK audit identified 6 bugs in the Go SDK across hand-written files, mustache templates, and build scripts. All fixes target the correct layer — hand-written code or templates/build scripts — so generated code will be corrected on next
make build.Bug Fixes
Critical
G1: Wrong error variable in
localConfig()andhomeConfig()silently swallows config parse errorsconfiguration.goL109, L138:if err2 := viper.ReadInConfig(); err != nilcheckederr(from the earlieros.Executable()/os.UserHomeDir()call) instead oferr2. Sinceerrwas alwaysnilat that point, config file parse errors were silently swallowed.errtoerr2in both functions.Medium
G2: Global viper instance pollution between
localConfig()andhomeConfig()configuration.goL104-L107, L134-L136: Both functions calledviper.AddConfigPath(),viper.SetConfigName(),viper.SetConfigType()on the global viper instance. Config paths fromlocalConfig()leaked intohomeConfig(), potentially causing the wrong config file to be loaded.v := viper.New()instance.Low
G3: Unused variables, dead code, and unnecessary import in
client.goclient.go: Removed unusedjsonCheck/xmlCheckregexp vars, unusedcfg/common/tokenfields onAPIClient, the deadservicestruct, and the"regexp"import.G4: Generated tests don't compile — missing required
ClientConfigurationargumentsdk-resources/resources/api_test.mustacheL24: Template calledNewConfiguration()with no arguments, butNewConfigurationrequires aClientConfigurationparameter.NewConfiguration({{goImportAlias}}.ClientConfiguration{}).G5: Missing
awaitonfs.unlink()andfs.writeFile()in postscript.jssdk-resources/postscript.jsL178, L230: Fire-and-forget promises could cause race conditions during code generation.awaitto both calls.G6: Broken
fs.stat()check inmoveFiles()—fs.stat()throws on missing path instead of returning falsysdk-resources/postscript.jsL74:if (!await fs.stat(destPath))always throws when the path doesn't exist (promises-basedfs.statthrowsENOENT), so themkdirfallback never executes.await fs.mkdir(destPath, { recursive: true })which is a no-op if the directory already exists.Verification
go build .passes clean (hand-written code compiles)make build— existing generated test files inapi_*/test/have the pre-existing bugTest plan
go build ./...after nextmake buildto verify generated tests compileconfig.jsonand home~/.sailpoint/config.yamlmake buildto verify postscript.js fixes work during code generation🤖 Generated with Claude Code