Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive structs #34

Open
snaffi opened this issue Nov 2, 2018 · 0 comments
Open

Recursive structs #34

snaffi opened this issue Nov 2, 2018 · 0 comments

Comments

@snaffi
Copy link

snaffi commented Nov 2, 2018

Hi, this fix #26 didn't work with another type of recursive structs

Code

package main

import (
	"context"
	"flag"
	"log"
	"net/http"
	"os"

	"github.com/semrush/zenrpc"
)

type MyModelWithRef struct {
	Model *MyModel
}

type MyModel struct {
	List []*MyModelWithRef
}

type MyService struct{ zenrpc.Service }

func (s MyService) SomeMethod(ctx context.Context, model MyModel) error {
	return nil
}


//go:generate zenrpc

func main() {
	addr := flag.String("addr", "localhost:9999", "listen address")
	flag.Parse()

	rpc := zenrpc.NewServer(zenrpc.Options{ExposeSMD: true})
	rpc.Register("service", MyService{})
	rpc.Use(zenrpc.Logger(log.New(os.Stderr, "", log.LstdFlags)))

	http.Handle("/", rpc)

	log.Printf("starting on %s", *addr)
	log.Fatal(http.ListenAndServe(*addr, nil))
}

Error

Generator version: 1.0.1
Entrypoint: ./
runtime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants