-
Notifications
You must be signed in to change notification settings - Fork 862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refine sdk automation tool #23959
base: main
Are you sure you want to change the base?
refine sdk automation tool #23959
Conversation
@JiaqiZhang-Dev, could you help to review this PR? Thanks |
@lirenhe 👌 |
log.Printf("##[command]Executing go mod tidy in %s\n", packagePath) | ||
if err = ExecuteGo(packagePath, "mod", "tidy"); err != nil { | ||
if packageRelativePath != moduleRelativePath { | ||
// remove go.mod for sub package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some questions about this operation
- The condition of existing sub package is like this?
service-dir: "sdk/resourcemanager/service_name"
package-dir: "package_name"
module: "github.com/Azure/azure-sdk-for-go/{service-dir}/{package-dir}/subpackage_name" - why was the sub package's go.mod generated? Is it a problem of 'tsp-client init' command?
- Does there has existed these sub package go.mod? how about processing the current existed go.mod for sub package in the repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check for the comments, thx~
if err != nil { | ||
return nil, err | ||
} | ||
|
||
log.Printf("Update module definition if v2+...") | ||
err = UpdateModuleDefinition(packagePath, packageModuleRelativePath, version) | ||
err = UpdateModuleDefinition(packagePath, packageRelativePath, version) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there should be the modelPath and moduleRelativePath?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current impl is kind of a workaround. i separated the module from package since current go code generator does not support namespace in typespec.
@@ -191,9 +203,6 @@ func (tc TypeSpecConfig) GetModuleName() ([2]string, error) { | |||
module := (option.(map[string]any))["module"].(string) | |||
s := strings.Split(module, "/") | |||
l := len(s) | |||
if l != 7 { | |||
return [2]string{}, fmt.Errorf("module is invalid and must be in the format of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/{rpName}/{packageName}`") | |||
} | |||
if !strings.Contains(s[l-1], "arm") && !strings.Contains(s[l-1], "az") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid an array out-of-bounds error, there could be added a length check~
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just leave this pr open. after we have a conclusion about the sub package generation, you could refactor all the generator tool.
follow up tasks: