当前位置:网站首页>golang通过指针for...range实现切片中元素的值的更改
golang通过指针for...range实现切片中元素的值的更改
2022-07-05 18:36:00 【学亮编程手记】
*(&build.Args[2])=destination
*(&build.Args[6])=cacherepo
//解决再次编辑时,workflow template得不到更新的问题。
//最新解决方案:通过argo workflow的全局参数机制来解决
builds := argoflowObject.Spec.Templates.Build
for _, build := range builds {
repoUrl:=build.BuildFormData.RepoUrl
if strings.Contains(repoUrl,"https://"){
repoUrl=strings.ReplaceAll(build.BuildFormData.RepoUrl,"https://","")
}
if strings.Contains(repoUrl,"http://"){
repoUrl=strings.ReplaceAll(build.BuildFormData.RepoUrl,"http://","")
}
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)
}
边栏推荐
猜你喜欢
【历史上的今天】7 月 5 日:Google 之母出生;同一天诞生的两位图灵奖先驱
深入底层C源码讲透Redis核心设计原理
Word查找红色文字 Word查找颜色字体 Word查找突出格式文本
Oracle 中文排序 Oracle 中文字段排序
About Estimation with Cross-Validation
FCN: Fully Convolutional Networks for Semantic Segmentation
[detailed explanation of AUTOSAR 14 startup process]
Case sharing | integrated construction of data operation and maintenance in the financial industry
SAP 特征 特性 说明
Isprs2022/ cloud detection: cloud detection with boundary nets
随机推荐
EasyCVR授权到期页面无法登录,该如何解决?
5. 数据访问 - EntityFramework集成
Rse2020/ cloud detection: accurate cloud detection of high-resolution remote sensing images based on weak supervision and deep learning
RPC协议详解
案例分享|金融业数据运营运维一体化建设
解决 contents have differences only in line separators
2022全网最全的腾讯后台自动化测试与持续部署实践【万字长文】
【Autosar 十四 启动流程详解】
RPC protocol details
The era of Web3.0 is coming. See how Tianyi cloud storage resources revitalize the system to enable new infrastructure (Part 2)
Memory leak of viewpager + recyclerview
2022 Alibaba Android advanced interview questions sharing, 2022 Alibaba hand Taobao Android interview questions
c语言简便实现链表增删改查「建议收藏」
Use QT to traverse JSON documents and search sub objects
输油管的布置数学建模matlab,输油管布置的数学模型
What is text mining? "Suggested collection"
一朵云开启智慧交通新未来
C final review
C language makes it easy to add, delete, modify and check the linked list "suggested collection"
集合处理的利器