Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
go plugin: Support local sources #97
Conversation
elopio
reviewed
Nov 14, 2015
| + - go-packages: | ||
| + (list of strings) | ||
| + Go packages to fetch, these must be a "main" package. Dependencies | ||
| + are pulled in automatically by `go get`. |
elopio
reviewed
Nov 14, 2015
| def pull(self): | ||
| # use -d to only download (build will happen later) | ||
| # use -t to also get the test-deps | ||
| - self._run(['go', 'get', '-t', '-d', self.fullname]) | ||
| + super().pull() |
elopio
Nov 14, 2015
Member
So if the source is git://name/project, will this get the repo two times?
first pull will download it to src, and then _local_pull will download it to src/go/src?
I'm not sure if I'm missing something.
sergiusens
Nov 14, 2015
Collaborator
On Fri, Nov 13, 2015 at 9:30 PM, Leo Arias notifications@github.com wrote:
In snapcraft/plugins/go.py
ubuntu-core#97 (comment):def pull(self): # use -d to only download (build will happen later) # use -t to also get the test-deps
self._run(['go', 'get', '-t', '-d', self.fullname])super().pull()So if the source is git://name/project, will this get the repo two times?
first pull will download it to src, and then _local_pull will download it
to src/go/src?
I'm not sure if I'm missing something.super().pull() will bring in the source (git://name/project)
self._local_pull() brings in the dependencies for that source.
chipaca
reviewed
Nov 14, 2015
| @@ -0,0 +1,243 @@ | ||
| +package main |
chipaca
reviewed
Nov 14, 2015
| + return strconv.Atoi(s) | ||
| + } | ||
| + | ||
| + // dd supports suffixes via two chars like "kB" |
chipaca
reviewed
Nov 14, 2015
| + result[i] = device | ||
| + l = l.next | ||
| + } | ||
| + C.g_list_free(l) |
chipaca
Nov 14, 2015
Member
wouldn't doing this in a defer be better? Ie,
l := C.g_udev_client_query_by_subsystem(c.p, (*C.gchar)(C.CString(subsystem)))
defer C.g_list_free(l)
chipaca
reviewed
Nov 14, 2015
| +} | ||
| + | ||
| +func (c *Client) QueryBySubsystem(subsystem string) []Device { | ||
| + l := C.g_udev_client_query_by_subsystem(c.p, (*C.gchar)(C.CString(subsystem))) |
chipaca
reviewed
Nov 14, 2015
| + // convert go to char ** | ||
| + cs := make([]*C.gchar, len(subsystems)+1) | ||
| + for i := range subsystems { | ||
| + cs[i] = (*C.gchar)(C.CString(subsystems[i])) |
chipaca
reviewed
Nov 14, 2015
| +} | ||
| + | ||
| +func (d *Device) GetSysfsAttr(name string) string { | ||
| + res := C.g_udev_device_get_sysfs_attr(d.p, (*C.gchar)(C.CString(name))) |
chipaca
reviewed
Nov 14, 2015
| +} | ||
| + | ||
| +func (d *Device) GetProperty(name string) string { | ||
| + res := C.g_udev_device_get_property(d.p, (*C.gchar)(C.CString(name))) |
|
|
sergiusens commentedNov 13, 2015
This also avoids the error of checking for
:in self.options.sourceCloses LP: #1499240
Closes LP: #1515132
Signed-off-by: Sergio Schvezov sergio.schvezov@canonical.com