Guest User

Untitled

a guest
Aug 16th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. var runContent= []byte(`
  2.  
  3. - runners:
  4. - name: function1
  5. type: func1
  6. - command: spawn child process
  7. - command: build
  8. - command: gulp
  9.  
  10. - name: function1
  11. type: func2
  12. - command: run function 1
  13. - name: function3
  14. type: func3
  15. - command: ruby build
  16.  
  17. - name: function4
  18. type: func4
  19. - command: go build
  20.  
  21. `)
  22.  
  23. type Runners struct {
  24.  
  25. runners string `yaml:"runners"`
  26. name string `yaml:”name”`
  27. Type: string `yaml: ”type”`
  28. command [] Command
  29. }
  30.  
  31.  
  32. type Command struct {
  33. command string `yaml: ”command”`
  34. }
  35.  
  36.  
  37.  
  38. runners := Runners{}
  39. // parse mta yaml
  40. err = yaml.Unmarshal(runContent, &runners)
  41. if err != nil {
  42. log.Fatalf("Error : %v", err)
  43. }
Add Comment
Please, Sign In to add comment