I am using the go component resource and am able t...
# golang
c
I am using the go component resource and am able to run make install. I am trying to create an example project for my custom resource library but am unsure how I should reference the package.
Copy code
import (
	svmkit "<http://github.com/abklabs/pulumi-svmkit/sdk/go|github.com/abklabs/pulumi-svmkit/sdk/go>"
    ...
)

-------
could not import <http://github.com/abklabs/pulumi-svmkit/sdk/go|github.com/abklabs/pulumi-svmkit/sdk/go> (no required module provides package "<http://github.com/abklabs/pulumi-svmkit/sdk/go|github.com/abklabs/pulumi-svmkit/sdk/go>")
Any assistance appreciated.
t
You can override paths in your go.mod
c
Ok and it should point to the provider directory?
Copy code
module dummy

go 1.21

require (
	<http://github.com/abklabs/pulumi-svmkit/sdk|github.com/abklabs/pulumi-svmkit/sdk> v0.1.0
	<http://github.com/abklabs/pulumi-svmkit/sdk/go|github.com/abklabs/pulumi-svmkit/sdk/go> v0.1.0
)

replace <http://github.com/abklabs/pulumi-svmkit/sdk/go|github.com/abklabs/pulumi-svmkit/sdk/go> => ../../provider
Adjusted to this
Copy code
require (
	github.com/abklabs/pulumi-svmkit/sdk/go v0.0.0
)

replace github.com/abklabs/pulumi-svmkit/sdk/go => ../../provider
Copy code
go mod tidy
go: finding module for package github.com/abklabs/pulumi-svmkit/sdk/go
go: dummy imports
        github.com/abklabs/pulumi-svmkit/sdk/go: module github.com/abklabs/pulumi-svmkit/sdk/go@latest found (v0.0.0-00010101000000-000000000000, replaced by ../../provider), but does not contain package github.com/abklabs/pulumi-svmkit/sdk/go
t
Without seeing the layout it's hard to say
c
its the exact same as the example repository where I have my component in provider/pkg/provider/
https://github.com/abklabs/pulumi-svmkit/tree/espi/golang @thankful-flower-8175 here is the branch.
t
Ah my bad. I misunderstood I think
Check the pulumi-go-provider repo for an example. I think you need to generate an sdk and add it to pulumi.yaml right? If it's just a component it's pretty easy. Still easy for provider. If this repo already does that it needs to be in the Pulumi yaml I believe
So iiuc you need to actually run the gen sdk and then consime that right?
c
Copy code
gen_go_sdk::
	rm -rf sdk/go
	cd provider/cmd/${CODEGEN} && go run . go ../../../sdk/go ${SCHEMA_PATH}

## Empty build target for Go
build_go_sdk::
Ok I'll review the pulumi-go-provider but the make file for the component template has this wher does gen go sdk but there is nod build_go_sdki and within the sdk directories I only see dotnet and nodejs
Copy code
# Pulumi.yaml
language:
    csharp:
        packageReferences:
            Pulumi: "3.*"
            Pulumi.Command: "1.*"
    go:
        generateResourceContainerTypes: true
        importBasePath: github.com/abklabs/pulumi-svmkit/sdk/go/svmkit
Ah import path has svmkit at the end
I got sdk directory populated after running
Copy code
pulumi package gen-sdk ./bin/pulumi-resource-svmkit
t
Great did it work?
c
The sdk doesn't contain a go.mod
t
If I'm honest I've only read a bunch of code and docs on this and never done it myself so I'm at a limit. I can try to replicate what you're doing later today to help. Sorry I can't be of more help right now
c
I ditched doing the go example and just building and doing typescript. Appreciate you working though it with me. If I finally figure it out I’ll post for others.