Browse Source

CodeStyle Fixes and Import Fixes.

layerset
Till Wegmüller 6 years ago
parent
commit
19766fb089
  1. 2
      bootadm/config.go
  2. 2
      cmd/imageadm.go
  3. 2
      cmd/imageadm/build.go
  4. 2
      cmd/imageadm/config.go
  5. 19
      cmd/imageadm/create.go
  6. 2
      cmd/imageadm/resolve.go
  7. 4
      cmd/imageadm/root.go
  8. 6
      cmd/imageadm/set-config.go
  9. 5
      common/common.go
  10. 2
      daemon/daemon.go
  11. 6
      daemons/installd.go
  12. 4
      image/build.go
  13. 1
      image/build_test.go
  14. 8
      image/config.go
  15. 2
      image/profile.go
  16. 5
      imaged/daemon.go
  17. 2
      imaged/main.go
  18. 4
      installd/filesystem.go
  19. 8
      installd/install.go
  20. 2
      ldd/ldd.go
  21. 2
      main.go
  22. 2
      zfs/list.go
  23. 2
      zpool/common.go
  24. 2
      zpool/create.go
  25. 6
      zpool/pool.go
  26. 2
      zpool/property.go

2
bootadm/config.go

@ -6,8 +6,8 @@ import (
"os"
"text/template"
"git.wegmueller.it/opencloud/opencloud/uname"
"github.com/toasterson/mozaik/logger"
"github.com/toasterson/opencloud/uname"
)
const (

2
cmd/imageadm.go

@ -14,7 +14,7 @@
package main
import "github.com/toasterson/opencloud/cmd/imageadm"
import "git.wegmueller.it/opencloud/opencloud/cmd/imageadm"
func main() {
cmd.Execute()

2
cmd/imageadm/build.go

@ -6,8 +6,8 @@ import (
"os"
"path/filepath"
"git.wegmueller.it/opencloud/opencloud/image"
"github.com/spf13/cobra"
"github.com/toasterson/opencloud/image"
)
var (

2
cmd/imageadm/config.go

@ -3,8 +3,8 @@ package cmd
import (
"fmt"
"git.wegmueller.it/opencloud/opencloud/image"
"github.com/spf13/cobra"
"github.com/toasterson/opencloud/image"
)
// createCmd represents the create command

19
cmd/imageadm/create.go

@ -5,9 +5,8 @@ import (
"path/filepath"
"git.wegmueller.it/opencloud/opencloud/image"
"github.com/spf13/cobra"
"github.com/toasterson/mozaik/util"
"github.com/toasterson/opencloud/image"
)
var (
@ -50,14 +49,20 @@ func init() {
func createCmdrun(cmd *cobra.Command, args []string) {
imgname := args[0]
imgdir, err := filepath.Abs(imgdir)
util.Must(err)
if err != nil{
panic(err)
}
imgp := filepath.Join(imgdir, imgname)
err = os.Mkdir(imgp, 0755)
if !os.IsExist(err){
util.Must(err)
if err != nil{
panic(err)
}
}
profile, err := image.NewProfile(imgname)
util.Must(err)
if err != nil{
panic(err)
}
config, err := image.LoadConfiguration(cfgFile)
for _, set := range sets{
section, ok := config.Sections[set]
@ -72,5 +77,7 @@ func createCmdrun(cmd *cobra.Command, args []string) {
profile.ResolveFiles(&config)
}
err = profile.Save(imgp)
util.Must(err)
if err != nil{
panic(err)
}
}

2
cmd/imageadm/resolve.go

@ -6,8 +6,8 @@ import (
"os"
"path/filepath"
"git.wegmueller.it/opencloud/opencloud/image"
"github.com/spf13/cobra"
"github.com/toasterson/opencloud/image"
)
var (

4
cmd/imageadm/root.go

@ -18,9 +18,9 @@ import (
"fmt"
"os"
"git.wegmueller.it/opencloud/opencloud/image"
"git.wegmueller.it/toasterson/glog"
"github.com/spf13/cobra"
"github.com/toasterson/glog"
"github.com/toasterson/opencloud/image"
)
var (

6
cmd/imageadm/set-config.go

@ -4,8 +4,8 @@ import (
"fmt"
"strings"
"git.wegmueller.it/opencloud/opencloud/image"
"github.com/spf13/cobra"
"github.com/toasterson/opencloud/image"
)
var (
@ -25,11 +25,11 @@ var setConfigCmd = &cobra.Command{
Run: setConfigCmdrun,
Args: func(cmd *cobra.Command, args []string) error {
if len(args) < 1 {
return fmt.Errorf("At least one argument required")
return fmt.Errorf("at least one argument required")
}
for _, arg := range args{
if !strings.Contains(arg, "="){
return fmt.Errorf("Arguments must have name=value syntax. %s does not", arg)
return fmt.Errorf("arguments must have name=value syntax. %s does not", arg)
}
}
return nil

5
common/common.go

@ -7,7 +7,10 @@ import (
"os"
)
var Stdlog, Errlog *log.Logger
var (
Errlog *log.Logger
Stdlog *log.Logger
)
func NotSupportedError(functionality string) error {
return errors.New(fmt.Sprintf("Functionality %s is currently not Supported", functionality))

2
daemon/daemon.go

@ -8,8 +8,8 @@ import (
"os/signal"
"syscall"
"git.wegmueller.it/opencloud/opencloud/common"
"github.com/takama/daemon"
"github.com/toasterson/opencloud/common"
)
type Server struct {

6
daemons/installd.go

@ -7,11 +7,11 @@ import (
"strings"
"git.wegmueller.it/opencloud/opencloud/common"
"git.wegmueller.it/opencloud/opencloud/devprop"
"git.wegmueller.it/opencloud/opencloud/installd"
"github.com/toasterson/mozaik/logger"
"github.com/toasterson/mozaik/util"
"github.com/toasterson/opencloud/common"
"github.com/toasterson/opencloud/devprop"
"github.com/toasterson/opencloud/installd"
)
func main() {

4
image/build.go

@ -7,10 +7,10 @@ import (
"compress/gzip"
"os"
"git.wegmueller.it/toasterson/glog"
"git.wegmueller.it/toasterson/uxfiletool"
"github.com/appc/spec/aci"
"github.com/pkg/errors"
"github.com/toasterson/glog"
"github.com/toasterson/uxfiletool"
)
func BuildChroot(imageProfile *Profile, target string) error {

1
image/build_test.go

@ -0,0 +1 @@
package image

8
image/config.go

@ -7,10 +7,10 @@ import (
"os"
"github.com/toasterson/glog"
"github.com/toasterson/opencloud/common"
"github.com/toasterson/opencloud/ldd"
"github.com/toasterson/uxfiletool"
"git.wegmueller.it/opencloud/opencloud/common"
"git.wegmueller.it/opencloud/opencloud/ldd"
"git.wegmueller.it/toasterson/glog"
"git.wegmueller.it/toasterson/uxfiletool"
)
var Default_path string = "/etc/imagedefs.json"

2
image/profile.go

@ -24,7 +24,7 @@ func (t Type) Validate() error {
TypeTar,
TypeACI:
default:
return fmt.Errorf("Image Type not known use one of ZFS|UFS|Chroot|Tar")
return fmt.Errorf("image Type not known use one of ZFS|UFS|Chroot|Tar")
}
return nil
}

5
imaged/daemon.go

@ -1,7 +1,7 @@
package imaged
import (
"github.com/toasterson/opencloud/zfs"
"git.wegmueller.it/opencloud/opencloud/zfs"
)
const (
@ -14,9 +14,10 @@ const (
)
type Imaged struct {
}
func (this *Imaged) List(pool string, reply *[]string) (err error) {
func (i *Imaged) List(pool string, reply *[]string) (err error) {
*reply, err = zfs.List(pool)
return err
}

2
imaged/main.go

@ -5,7 +5,7 @@ import (
"github.com/takama/daemon"
"os"
"fmt"
"github.com/toasterson/opencloud/common"
"git.wegmueller.it/opencloud/opencloud/common"
)
func main() {

4
installd/filesystem.go

@ -3,10 +3,10 @@ package installd
import (
"fmt"
"git.wegmueller.it/opencloud/opencloud/zfs"
"git.wegmueller.it/opencloud/opencloud/zpool"
"github.com/satori/go.uuid"
"github.com/toasterson/mozaik/util"
"github.com/toasterson/opencloud/zfs"
"github.com/toasterson/opencloud/zpool"
)
func CreateAndMountZpool(conf *InstallConfiguration) (err error) {

8
installd/install.go

@ -5,11 +5,11 @@ import (
"os"
"path/filepath"
"git.wegmueller.it/opencloud/opencloud/bootadm"
"git.wegmueller.it/opencloud/opencloud/common"
"git.wegmueller.it/opencloud/opencloud/mount"
"git.wegmueller.it/opencloud/opencloud/zfs"
"github.com/toasterson/mozaik/util"
"github.com/toasterson/opencloud/bootadm"
"github.com/toasterson/opencloud/common"
"github.com/toasterson/opencloud/mount"
"github.com/toasterson/opencloud/zfs"
)
const altRootLocation string = "/a"

2
ldd/ldd.go

@ -11,9 +11,9 @@ import (
"os"
"git.wegmueller.it/opencloud/opencloud/common"
"github.com/h2non/filetype"
_ "github.com/h2non/filetype"
"github.com/toasterson/opencloud/common"
)
var lib_paths = []string{"/usr/lib", "/lib"}

2
main.go

@ -3,7 +3,7 @@ package main
import (
"fmt"
"github.com/toasterson/uxfiletool"
"git.wegmueller.it/toasterson/uxfiletool"
)
func main() {

2
zfs/list.go

@ -33,7 +33,7 @@ func UsedIncludingChildren(dataset string) (size datasize.ByteSize, err error) {
func zfsListSomeSize(dataset string, parameters ...string) (size datasize.ByteSize, err error) {
//TODO switch to use -Hp as this does not print first line
if dataset == "" {
return size, errors.New("Dataset is not allowed to be empty.")
return size, errors.New("dataset is not allowed to be empty")
}
zfs_args := []string{"-o"}
for i, param := range parameters {

2
zpool/common.go

@ -7,8 +7,8 @@ import (
"os/exec"
"strings"
"git.wegmueller.it/opencloud/opencloud/zfs"
"github.com/toasterson/mozaik/logger"
"github.com/toasterson/opencloud/zfs"
)
// Pool - ZFS dataset object

2
zpool/create.go

@ -4,7 +4,7 @@ import (
"fmt"
"runtime"
"github.com/toasterson/opencloud/zfs"
"git.wegmueller.it/opencloud/opencloud/zfs"
)
// Create a new Zfs Pool on the Followin disks with mode

6
zpool/pool.go

@ -4,7 +4,7 @@ import (
"regexp"
"strings"
"github.com/toasterson/opencloud/zfs"
"git.wegmueller.it/opencloud/opencloud/zfs"
)
func OpenPool(name string) (p Pool) {
@ -20,8 +20,8 @@ func OpenPool(name string) (p Pool) {
propName := propLine[1]
prop := zfs.Property{
propLine[2],
propLine[3],
Value: propLine[2],
Source: propLine[3],
}
p.Properties[propName] = prop

2
zpool/property.go

@ -4,7 +4,7 @@ import (
"fmt"
"strings"
"github.com/toasterson/opencloud/zfs"
"git.wegmueller.it/opencloud/opencloud/zfs"
)
// SetProperty set ZFS pool property to value. Not all properties can be set,

Loading…
Cancel
Save