go_version

package module
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2021 License: MIT Imports: 5 Imported by: 0

README

go-version

A package helps to get golang latest and all version go's download url\file size\checksum\os\arch etc. a little example

package main

import (
	"fmt"
	"log"

	goversion "github.com/czyt/go-version"
)

func main() {
	downLoader := goversion.NewDownLoader("https://golang.google.cn")
	versions, err := downLoader.GetFeaturedDownload()
	if err != nil {
		log.Fatal(err)
	}
	for _, v := range versions {
		fmt.Println(v.DownloadUrl)
	}
}

中文

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownLoader

type DownLoader struct {
	Host string
}

func NewDownLoader

func NewDownLoader(host string) *DownLoader

func (DownLoader) GetAllDownload

func (d DownLoader) GetAllDownload() ([]GoVersionInfoList, error)

GetAllDownload returns the All version golang download info

func (DownLoader) GetFeaturedDownload

func (d DownLoader) GetFeaturedDownload() ([]GoVersionInfoLite, error)

GetFeaturedDownload returns the latest version golang download info but with few extra info

type GoVersionInfoFull

type GoVersionInfoFull struct {
	GoVersionInfoLite
	Arch        string `json:"arch,omitempty"`
	PackageType string `json:"package_type,omitempty"`
	SHA256      string `json:"sha256,omitempty"`
}

type GoVersionInfoList

type GoVersionInfoList struct {
	Category string
	InfoList []GoVersionInfoFull
}

type GoVersionInfoLite

type GoVersionInfoLite struct {
	OS          string `json:"os,omitempty"`
	FileName    string `json:"file_name,omitempty"`
	DownloadUrl string `json:"download_url,omitempty"`
	Size        string `json:"size"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL