Guest User

Untitled

a guest
May 27th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. #Description for npm install
  2. npm install
  3. #Description for test
  4. npm test
  5. #Description for test2
  6. run test2
  7.  
  8. // example with switch
  9. func (d Dependency) TypeCommand() Command {
  10. switch d.Type {
  11. case "runner":
  12.  
  13. cmd1 := Command{"#Description for npm install", "npm install"}
  14. cmd2 := Command{"#Description for test", "npm test"}
  15. cmd3 := Command{"#Description for test2", "run test2"}
  16.  
  17. case "runner2":
  18. return "test 2"
  19.  
  20. }
  21. return "command_baz"
  22. }
  23.  
  24.  
  25. **The template is:**
  26.  
  27. const tmpl = `
  28. {{- range .File.Dependency}}
  29.  
  30. {{.TypeCommand}}
  31. {{end}}`
  32.  
  33.  
  34. When I change the template for the following I got error:
  35.  
  36.  
  37.  
  38. const tmpl = `
  39. {{- range .File.Dependency}}
  40.  
  41. {{ TypeCommand .}}
  42. {{ range .Command}}
  43. {{ .Info }}
  44. {{ .Command }}
  45. {{end}}
  46. {{end}}
  47. '
Add Comment
Please, Sign In to add comment