GOLANG_DIGEST Telegram 24
go-git - реализация Git на Go

Это не просто клиент, а полноценная реализация на чистом Go.
Она создана для удобной интеграции Git в сервисы, написанные на Go.

go-git ориентирован на расширяемость, совместимость и поддерживает большинство подключаемых API, которые описаны здесь.

Пример использования:

_, err := git.PlainClone("/tmp/foo", false, &git.CloneOptions{
URL: "https://github.com/go-git/go-git",
Progress: os.Stdout,
})

————
Counting objects: 4924, done.
Compressing objects: 100% (1333/1333), done.
Total 4924 (delta 530), reused 6 (delta 6), pack-reused 3533

В результате, мы получаем экземпляр Repository и можем делать с ним всякое:

// получаем ветку по указателю HEAD
ref, err := r.Head()

// получаем объект коммита по указателю ref
commit, err := r.CommitObject(ref.Hash())

// получаем историю коммита
history, err := commit.History()

// проходим по коммитам и выводим каждый из них
for _, c := range history {
fmt.Println(c)
}

Чуть больше информации см. здесь.
🔥4🤔3



tgoop.com/golang_digest/24
Create:
Last Update:

go-git - реализация Git на Go

Это не просто клиент, а полноценная реализация на чистом Go.
Она создана для удобной интеграции Git в сервисы, написанные на Go.

go-git ориентирован на расширяемость, совместимость и поддерживает большинство подключаемых API, которые описаны здесь.

Пример использования:

_, err := git.PlainClone("/tmp/foo", false, &git.CloneOptions{
URL: "https://github.com/go-git/go-git",
Progress: os.Stdout,
})

————
Counting objects: 4924, done.
Compressing objects: 100% (1333/1333), done.
Total 4924 (delta 530), reused 6 (delta 6), pack-reused 3533

В результате, мы получаем экземпляр Repository и можем делать с ним всякое:

// получаем ветку по указателю HEAD
ref, err := r.Head()

// получаем объект коммита по указателю ref
commit, err := r.CommitObject(ref.Hash())

// получаем историю коммита
history, err := commit.History()

// проходим по коммитам и выводим каждый из них
for _, c := range history {
fmt.Println(c)
}

Чуть больше информации см. здесь.

BY Golang Дайджест




Share with your friend now:
tgoop.com/golang_digest/24

View MORE
Open in Telegram


Telegram News

Date: |

With the administration mulling over limiting access to doxxing groups, a prominent Telegram doxxing group apparently went on a "revenge spree." A vandalised bank during the 2019 protest. File photo: May James/HKFP. Telegram iOS app: In the “Chats” tab, click the new message icon in the right upper corner. Select “New Channel.” End-to-end encryption is an important feature in messaging, as it's the first step in protecting users from surveillance. Hashtags are a fast way to find the correct information on social media. To put your content out there, be sure to add hashtags to each post. We have two intelligent tips to give you:
from us


Telegram Golang Дайджест
FROM American