golang通过指针for...range实现切片中元素的值的更改

*(&build.Args[2])=destination*(&build.Args[6])=cacherepo

golang通过指针for...range实现切片中元素的值的更改

//解决再次编辑时,workflow template得不到更新的问题。//最新解决方案:通过argo workflow的全局参数机制来解决builds := argoflowObject.Spec.Templates.Buildfor _, build := range builds { repoUrl:=build.BuildFormData.RepoUrl if strings.Contains(repoUrl," repoUrl=strings.ReplaceAll(build.BuildFormData.RepoUrl," } if strings.Contains(repoUrl," repoUrl=strings.ReplaceAll(build.BuildFormData.RepoUrl," } finalImageName:=repoUrl+"/"+build.BuildFormData.ImageName+":"+build.BuildFormData.ImageTag destination := build.Args[2] cacherepo := build.Args[6] destination=strings.Split(destination,"=")[0]+"="+finalImageName cacherepo=strings.Split(cacherepo,"=")[0]+"="+repoUrl+"/"+build.BuildFormData.ImageName *(&build.Args[2])=destination *(&build.Args[6])=cacherepo fmt.Println("build.Args:",build.Args)}