swag icon indicating copy to clipboard operation
swag copied to clipboard

var-declared function's doc not generated

Open book987 opened this issue 2 years ago • 1 comments

Describe the bug Currently function declared by var is ignored. But it indeed is a function, which might act as an API handler. The example below shows the case.

package main

func f() {}

// GetSth godoc
var GetSth = f

Furthermore, any variable pointing directly or indirectly to a function should not be ignored, and it's swag comment should be handled correctly.

package main

func f() {}

// F1 godoc
var F1 = f

// F2 godoc
var F2 = f1

// F3 godoc
var F3 = f2

To Reproduce see above

Expected behavior expect swag would generate docs realted to function declared by var

Screenshots If applicable, add screenshots to help explain your problem.

Your swag version e.g. 1.8.12

Your go version e.g. 1.19

Desktop (please complete the following information):

  • OS: mac
  • Browser: firefox
  • Version: [e.g. 22]

Additional context no more context

book987 avatar Aug 24 '23 14:08 book987

@ubogdan Hi, please take a look at this issue, if it is meaningful, there's a pr need review

book987 avatar Sep 15 '23 07:09 book987