Пример #1
0
// install from tar.gz source
func (i *Install) fromSource() (string, error) {
	if err := cache.CacheDownload(i.Version, i.Force); err != nil {
		return "error while installing from tar.gz source", err
	}
	if err := cache.Compile(i.Version, i.Verbose, i.NoCGO, i.BootStrap); err != nil {
		return "error while installing from tar.gz source", err
	}

	result := fmt.Sprintf(
		"%s", utils.Ok(fmt.Sprintf("Go %s installed", i.Version)))
	return result, nil
}
Пример #2
0
				Expect(ioutil.WriteFile(filename, []byte{}, 0644)).To(Succeed())
				filename = filepath.Join(cache.CacheDirectory(), "test1", ".vengo-manifest")

				Expect(ioutil.WriteFile(filename, []byte{}, 0644)).To(Succeed())
				Expect(cache.AlreadyCompiled("test1")).To(BeTrue())
				os.RemoveAll(filepath.Join(cache.CacheDirectory(), "test1"))

				Expect(cache.AlreadyCompiled("test1")).To(BeFalse())
			})
		})

		if RunSlowTests {
			Describe("CacheDownload works as expected", func() {
				Context("Passing a non valid Go version", func() {
					It("Should fail and give back a descriptive error", func() {
						err := cache.CacheDownload("1.0")
						Expect(err).To(HaveOccurred())
						Expect(err).To(Equal(fmt.Errorf(
							"1.0 is not a VenGO supported version you must donwload and compile it yourself"),
						))
					})
				})

				Context("Passing a valid Go version", func() {
					It("Should download and extract a valid tar.gz file", func() {
						Expect(cache.CacheDownload("1.2.2")).To(Succeed())

						_, err := os.Stat(filepath.Join(cache.CacheDirectory(), "1.2.2"))
						Expect(err).NotTo(HaveOccurred())
						os.RemoveAll(filepath.Join(cache.CacheDirectory(), "1.2.2"))
						debug.FreeOSMemory()