当前位置: 首页>>代码示例>>Golang>>正文


Golang Binary.String方法代码示例

本文整理汇总了Golang中launchpad/net/juju-core/version.Binary.String方法的典型用法代码示例。如果您正苦于以下问题:Golang Binary.String方法的具体用法?Golang Binary.String怎么用?Golang Binary.String使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在launchpad/net/juju-core/version.Binary的用法示例。


在下文中一共展示了Binary.String方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: putBinary

// putBinary stores a faked binary in the test directory.
func putBinary(c *gc.C, storagePath string, v version.Binary) {
	data := v.String()
	name := tools.StorageName(v)
	filename := filepath.Join(storagePath, name)
	dir := filepath.Dir(filename)
	err := os.MkdirAll(dir, 0755)
	c.Assert(err, gc.IsNil)
	err = ioutil.WriteFile(filename, []byte(data), 0666)
	c.Assert(err, gc.IsNil)
}
开发者ID:hivetech,项目名称:judo.legacy,代码行数:11,代码来源:sync_test.go

示例2: uploadTools

func (s *agentSuite) uploadTools(c *C, vers version.Binary) *tools.Tools {
	tgz := coretesting.TarGz(
		coretesting.NewTarFile("jujud", 0777, "jujud contents "+vers.String()),
	)
	storage := s.Conn.Environ.Storage()
	err := storage.Put(tools.StorageName(vers), bytes.NewReader(tgz), int64(len(tgz)))
	c.Assert(err, IsNil)
	url, err := s.Conn.Environ.Storage().URL(tools.StorageName(vers))
	c.Assert(err, IsNil)
	return &tools.Tools{URL: url, Binary: vers}
}
开发者ID:rif,项目名称:golang-stuff,代码行数:11,代码来源:agent_test.go

示例3: uploadFakeToolsVersion

func uploadFakeToolsVersion(storage environs.Storage, vers version.Binary) (*state.Tools, error) {
	data := vers.String()
	name := tools.StorageName(vers)
	log.Noticef("environs/testing: uploading FAKE tools %s", vers)
	if err := storage.Put(name, strings.NewReader(data), int64(len(data))); err != nil {
		return nil, err
	}
	url, err := storage.URL(name)
	if err != nil {
		return nil, err
	}
	return &state.Tools{Binary: vers, URL: url}, nil
}
开发者ID:CSRedRat,项目名称:juju-core,代码行数:13,代码来源:tools.go

示例4: uploadTools

// uploadTools uploads fake tools with the given version number
// to the dummy environment's storage and returns a tools
// value describing them.
func (s *UpgraderSuite) uploadTools(c *gc.C, vers version.Binary) *tools.Tools {
	// TODO(rog) make UploadFakeToolsVersion in environs/testing
	// sufficient for this use case.
	tgz := coretesting.TarGz(
		coretesting.NewTarFile("jujud", 0777, "jujud contents "+vers.String()),
	)
	storage := s.Conn.Environ.Storage()
	err := storage.Put(tools.StorageName(vers), bytes.NewReader(tgz), int64(len(tgz)))
	c.Assert(err, gc.IsNil)
	url, err := s.Conn.Environ.Storage().URL(tools.StorageName(vers))
	c.Assert(err, gc.IsNil)
	return &tools.Tools{URL: url, Version: vers}
}
开发者ID:hivetech,项目名称:judo.legacy,代码行数:16,代码来源:upgrader_test.go

示例5: PutBinary

// PutBinary stores a faked binary in the HTTP test storage.
func (s *EC2HTTPTestStorage) PutBinary(v version.Binary) {
	data := v.String()
	name := tools.StorageName(v)
	parts := strings.Split(name, "/")
	if len(parts) > 1 {
		// Also create paths as entries. Needed for
		// the correct contents of the list bucket result.
		path := ""
		for i := 0; i < len(parts)-1; i++ {
			path = path + parts[i] + "/"
			s.files[path] = []byte{}
		}
	}
	s.files[name] = []byte(data)
}
开发者ID:CSRedRat,项目名称:juju-core,代码行数:16,代码来源:storage.go

示例6: SharedToolsDir

// SharedToolsDir returns the directory that is used to
// store binaries for the given version of the juju tools
// within the dataDir directory.
func SharedToolsDir(dataDir string, vers version.Binary) string {
	return path.Join(dataDir, "tools", vers.String())
}
开发者ID:rif,项目名称:golang-stuff,代码行数:6,代码来源:toolsdir.go

示例7: ToolsStoragePath

// ToolsStoragePath returns the path that is used to store and
// retrieve the given version of the juju tools in a Storage.
func ToolsStoragePath(vers version.Binary) string {
	return toolPrefix + vers.String() + ".tgz"
}
开发者ID:prabhakhar,项目名称:juju-core,代码行数:5,代码来源:tools.go

示例8: StorageName

// StorageName returns the name that is used to store and retrieve the
// given version of the juju tools.
func StorageName(vers version.Binary) string {
	return toolPrefix + vers.String() + toolSuffix
}
开发者ID:CSRedRat,项目名称:juju-core,代码行数:5,代码来源:storage.go


注:本文中的launchpad/net/juju-core/version.Binary.String方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。