mirror of
https://github.com/strongdm/comply
synced 2025-12-06 06:14:09 +00:00
Update go.mod and adjust pandoc and watch usability (#64)
This commit is contained in:
@@ -46,8 +46,8 @@ func (g *gitlabPlugin) api() *gitlab.Client {
|
||||
defer g.clientMu.Unlock()
|
||||
if g.client == nil {
|
||||
// get go-gitlab client
|
||||
gl := gitlab.NewClient(nil, g.token)
|
||||
gl.SetBaseURL(g.domain)
|
||||
// TODO: see if it's necessary to verify the error
|
||||
gl, _ := gitlab.NewClient(g.token, gitlab.WithBaseURL(g.domain))
|
||||
g.client = gl
|
||||
}
|
||||
return g.client
|
||||
@@ -160,7 +160,7 @@ func (g *gitlabPlugin) Create(ticket *model.Ticket, labels []string) error {
|
||||
options := &gitlab.CreateIssueOptions{
|
||||
Title: gitlab.String(ticket.Name),
|
||||
Description: gitlab.String(ticket.Body),
|
||||
Labels: &l,
|
||||
Labels: l,
|
||||
}
|
||||
_, _, err := g.api().Issues.CreateIssue(g.reponame, options)
|
||||
return err
|
||||
|
||||
@@ -49,7 +49,7 @@ func dockerPandoc(outputFilename string, errOutputCh chan error) {
|
||||
resp, err := cli.ContainerCreate(ctx, &container.Config{
|
||||
Image: "strongdm/pandoc",
|
||||
Cmd: pandocCmd},
|
||||
hc, nil, "")
|
||||
hc, nil, nil, "")
|
||||
|
||||
if err != nil {
|
||||
errOutputCh <- errors.Wrap(err, "unable to create Docker container")
|
||||
@@ -71,9 +71,12 @@ func dockerPandoc(outputFilename string, errOutputCh chan error) {
|
||||
return
|
||||
}
|
||||
|
||||
_, err = cli.ContainerWait(ctx, resp.ID)
|
||||
if err != nil {
|
||||
errOutputCh <- errors.Wrap(err, "error awaiting Docker container")
|
||||
chanResult, chanErr := cli.ContainerWait(ctx, resp.ID, "not-running")
|
||||
resultValue := <-chanResult
|
||||
|
||||
if resultValue.StatusCode != 0 {
|
||||
err = <-chanErr
|
||||
errOutputCh <-errors.Wrap(err, "error awaiting Docker container")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,8 @@ import (
|
||||
)
|
||||
|
||||
func watch(errCh chan error) {
|
||||
b, err := watcher.New(300 * time.Millisecond)
|
||||
// TODO: study about the poll duration
|
||||
b, err := watcher.New(300 * time.Millisecond, 0, false)
|
||||
if err != nil {
|
||||
errCh <- err
|
||||
return
|
||||
@@ -25,7 +26,7 @@ func watch(errCh chan error) {
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case e := <-b.Errors:
|
||||
case e := <-b.Errors():
|
||||
errCh <- e
|
||||
case <-b.Events:
|
||||
broadcast()
|
||||
|
||||
Reference in New Issue
Block a user