Explorar o código

main: Add -debug flag for enabling debugger support (#27)

Reference: https://github.com/hashicorp/terraform-provider-scaffolding-framework/issues/8
Brian Flad %!s(int64=3) %!d(string=hai) anos
pai
achega
f1449bfe5c
Modificáronse 1 ficheiros con 8 adicións e 0 borrados
  1. 8 0
      main.go

+ 8 - 0
main.go

@@ -2,6 +2,7 @@ package main
 
 import (
 	"context"
+	"flag"
 	"log"
 
 	"github.com/hashicorp/terraform-plugin-framework/tfsdk"
@@ -28,7 +29,14 @@ var (
 )
 
 func main() {
+	var debug bool
+
+	flag.BoolVar(&debug, "debug", false, "set to true to run the provider with support for debuggers like delve")
+	flag.Parse()
+
 	opts := tfsdk.ServeOpts{
+		Debug: debug,
+
 		// TODO: Update this string with the published name of your provider.
 		Name: "registry.terraform.io/hashicorp/scaffolding",
 	}