The cog package provides functionality to develop reusable components (cogs) for Isomorphic Go web applications.

cog.go 665B

123456789101112131415161718192021222324252627282930313233343536
  1. // The UXToolkit Project
  2. // Copyright (c) Wirecog, LLC. All rights reserved.
  3. // Use of this source code is governed by a BSD-style
  4. // license, which can be found in the LICENSE file.
  5. package cog
  6. import (
  7. "go/build"
  8. "os"
  9. )
  10. var DefaultTemplatesDirectoryName string
  11. var DefaultGoSourcePath string
  12. var TemplateFileExtension = ".tmpl"
  13. var ReactivityEnabled = true
  14. var VDOMEnabled = true
  15. type Cog interface {
  16. Render() error
  17. Start() error
  18. }
  19. func init() {
  20. var gopath string
  21. gp := os.Getenv("GOPATH")
  22. if gp != "" {
  23. gopath = gp
  24. } else {
  25. gopath = build.Default.GOPATH
  26. }
  27. DefaultTemplatesDirectoryName = "templates"
  28. DefaultGoSourcePath = gopath + "/src"
  29. }