Git Product home page Git Product logo

Comments (2)

simba83524 avatar simba83524 commented on July 26, 2024

这个修改一下就可以了response.Rate.Remaining

from x-patrol.

netxfly avatar netxfly commented on July 26, 2024

github.com/google/go-github/github更新过了,数据结构有变化:

hartnett at hartnettdeMacBook-Pro in /data/code/golang/src/x-patrol (mi_dev)
$ go build main.go

hartnett at hartnettdeMacBook-Pro in /data/code/golang/src/x-patrol (mi_dev)
$ go get -u github.com/google/go-github/github
# cd /data/code/golang/src/github.com/google/go-github; git pull --ff-only
From https://github.com/google/go-github
   922ceac..8d8132c  master                -> origin/master
 * [new branch]      revert-844-teamreview -> origin/revert-844-teamreview
 * [new tag]         v10.0.0               -> v10.0.0
 * [new tag]         v11.0.0               -> v11.0.0
 * [new tag]         v12.0.0               -> v12.0.0
 * [new tag]         v13.0.0               -> v13.0.0
 * [new tag]         v14.0.0               -> v14.0.0
 * [new tag]         v2.0.0                -> v2.0.0
 * [new tag]         v3.0.0                -> v3.0.0
 * [new tag]         v4.0.0                -> v4.0.0
 * [new tag]         v5.0.0                -> v5.0.0
 * [new tag]         v6.0.0                -> v6.0.0
 * [new tag]         v7.0.0                -> v7.0.0
 * [new tag]         v8.0.0                -> v8.0.0
 * [new tag]         v9.0.0                -> v9.0.0
 * [new tag]         v15.0.0               -> v15.0.0
 * [new tag]         v16.0.0               -> v16.0.0
 * [new tag]         v17.0.0               -> v17.0.0
 * [new tag]         v18.0.0               -> v18.0.0
 * [new tag]         v18.1.0               -> v18.1.0
 * [new tag]         v18.2.0               -> v18.2.0
 * [new tag]         v19.0.0               -> v19.0.0
 * [new tag]         v19.1.0               -> v19.1.0
error: Your local changes to the following files would be overwritten by merge:
	github/github.go
	github/search.go
Please commit your changes or stash them before you merge.
Aborting
Updating 922ceac..8d8132c
package github.com/google/go-github/github: exit status 1

hartnett at hartnettdeMacBook-Pro in /data/code/golang/src/x-patrol (mi_dev)
$ rm -fr ../github.com/google/go-github

hartnett at hartnettdeMacBook-Pro in /data/code/golang/src/x-patrol (mi_dev)
$ go get -u github.com/google/go-github/github

hartnett at hartnettdeMacBook-Pro in /data/code/golang/src/x-patrol (mi_dev)
$ go build main.go
# x-patrol/models
models/github.go:97:35: response.Remaining undefined (type *github.Response has no field or method Remaining)
models/github.go:98:31: response.Reset undefined (type *github.Response has no field or method Reset)
models/github.go:99:31: response.Limit undefined (type *github.Response has no field or method Limit)

models/github.go中的代码改为以下就可以了:

func UpdateRate(token string, response *github.Response) (error) {
	githubToken := new(GithubToken)
	has, err := Engine.Table("github_token").Where("token=?", token).Get(githubToken)
	if err == nil && has {
		id := githubToken.Id
		githubToken.Remaining = response.Rate.Remaining
		githubToken.Reset = response.Rate.Reset.Time
		githubToken.Limit = response.Rate.Limit
		Engine.ID(id).Update(githubToken)
	}
	return err
}

util/githubsearch/gitclient.go:160:文件中相应的地方也要修改

$ go get -u github.com/google/go-github/github

hartnett at hartnettdeMacBook-Pro in /data/code/golang/src/x-patrol (mi_dev)
$ go build main.go
# x-patrol/models
models/github.go:97:35: response.Remaining undefined (type *github.Response has no field or method Remaining)
models/github.go:98:31: response.Reset undefined (type *github.Response has no field or method Reset)
models/github.go:99:31: response.Limit undefined (type *github.Response has no field or method Limit)

hartnett at hartnettdeMacBook-Pro in /data/code/golang/src/x-patrol (mi_dev)
$ go build main.go
# x-patrol/util/githubsearch
util/githubsearch/gitclient.go:160:10: resp.Remaining undefined (type *github.Response has no field or method Remaining)

hartnett at hartnettdeMacBook-Pro in /data/code/golang/src/x-patrol (mi_dev)
$ go build main.go

from x-patrol.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.