Skip to content

Commit d773cdd

Browse files
committed
chore:update go deploy config with go mod and go sum
1 parent e46206a commit d773cdd

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

test/deploy/linux/go/redhat/roles/configure/tasks/main.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
msg: Install go
44

55
- name: install go
6-
shell: yum install go -y
6+
shell: sudo yum install go -y
77
become: true
88

99
- name: Create templates directory
@@ -20,6 +20,18 @@
2020
- "../../../../templates/*"
2121
become: true
2222

23+
- name: Run go mod init
24+
shell: cd /home/ec2-user/templates && go mod init home/ec2-user/templates
25+
become: true
26+
27+
- name: Run go mod tidy
28+
shell: cd /home/ec2-user/templates && go mod tidy
29+
become: true
30+
31+
- name: Change Permissions for /home/ec2-user/templates
32+
shell: chown -R ec2-user:ec2-user /home/ec2-user/templates/ && chmod -R 755 /home/ec2-user/templates
33+
become: true
34+
2335
# Use the below command to run it locally
2436
# - name: Run sample go application
2537
# ansible.builtin.shell: cd ~/templates && go build . && nohup ./gosampleapp &

test/deploy/linux/go/templates/server.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ func main() {
1414
go client()
1515

1616
//codeSnippet
17+
18+
1719
transactions := make(chan string)
1820

1921
go func() {
@@ -26,6 +28,9 @@ func main() {
2628
}()
2729

2830
//routerSnippet
31+
32+
33+
2934
router.GET("/transaction", func(c *gin.Context) {
3035
transaction := <-transactions
3136
c.JSON(200, gin.H{

0 commit comments

Comments
 (0)