1// Copyright 2018 The Go Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5package server 6 7import ( 8 "context" 9 "errors" 10) 11 12type A struct { 13 x int 14} 15 16func (a *A) AMethod(y int) *Server { 17 return nil 18} 19 20// FooServer is a server that provides Foo services 21type FooServer Server 22 23func (f *FooServer) WriteEvents(ctx context.Context, x int) error { 24 return errors.New("hey!") 25} 26 27type Server struct { 28 FooServer *FooServer 29 user string 30 ctx context.Context 31} 32 33func New(sctx context.Context, u string) (*Server, error) { 34 s := &Server{user: u, ctx: sctx} 35 s.FooServer = (*FooServer)(s) 36 return s, nil 37} 38