#Getting a nil pointer dereference in a
1 messages · Page 1 of 1 (latest)
package main
import (
"context"
"encoding/json"
"fmt"
"strconv"
"time"
)
type Oauth struct{}
type Token struct {
Token string `json:"access_token"` //nolint:tagliatelle
}
func (m *Oauth) Retrieve(user string, pass *Secret, ctx context.Context) (string, error) {
const oauthEndpoint = (redacted)
curlCmd := `(redacted) \
> authReponse.json`
oauth := dag.Container().
From("(redacted)").
Pipeline("Get oAuth Token").
WithFocus().
WithSecretVariable("client_secret", pass).
WithEnvVariable("client_id", user).
WithWorkdir("/src").
WithEnvVariable("CACHE_BUSTER", strconv.Itoa(time.Now().Day())).
WithExec([]string{"sh", "-c", fmt.Sprintf(curlCmd, oauthEndpoint, "$client_id", "$client_secret")})
tokenFile := oauth.Directory("/src").File("authReponse.json")
t, err := tokenFile.Contents(ctx)
if err != nil {
return "", err
}
var token Token
err = json.Unmarshal([]byte(t), &token)
if err != nil {
return "", err
}
return token.Token, nil
}
Error: failed to automate vcs: failed to get vcs ignored paths: input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
input: resolve: module: withSource: failed to get modified source directory for go module sdk codegen: process "/usr/local/bin/codegen --module . --propagate-logs=true --introspection-json-path /schema.json" did not complete successfully: exit code: 1
I don't think I have any naming conflicts with go modules or core api.
Dagger 0.9.7
yup that was it. I just validated that.
Is that a known bug? If not happy to create an issue
or is it a feature? 🙂
It's "correct" that you get an error for this. But the error message was confusing, and didn't help you find the problem, then yeah I'd consider that a bug. Can't hurt to create an issue describing what confused you!