github.com/dkischenko/gomarkdoc@v0.0.0-20230516135336-e40deae8a495/testData/lang/function/README.md (about)

     1  <!-- Code generated by gomarkdoc. DO NOT EDIT -->
     2  
     3  # function
     4  
     5  ```go
     6  import "github.com/dkischenko/gomarkdoc/testData/lang/function"
     7  ```
     8  
     9  ## Index
    10  
    11  - [Constants](<#constants>)
    12  - [Variables](<#variables>)
    13  - [func Standalone(p1 int, p2 string) (int, error)](<#Standalone>)
    14  - [type Generic](<#Generic>)
    15    - [func (r Generic[T]) WithGenericReceiver()](<#Generic[T].WithGenericReceiver>)
    16  - [type Receiver](<#Receiver>)
    17    - [func New() Receiver](<#New>)
    18    - [func (r *Receiver) WithPtrReceiver()](<#Receiver.WithPtrReceiver>)
    19    - [func (r Receiver) WithReceiver()](<#Receiver.WithReceiver>)
    20  
    21  
    22  ## Constants
    23  
    24  <a name="ConstA"></a>Set of constants for this package.
    25  
    26  ```go
    27  const (
    28      ConstA = "string"
    29      ConstB = true
    30  )
    31  ```
    32  
    33  ## Variables
    34  
    35  <a name="Variable"></a>Variable is a package\-level variable.
    36  
    37  ```go
    38  var Variable = 5
    39  ```
    40  
    41  <a name="Standalone"></a>
    42  ## func [Standalone](<https://github.com/dkischenko/gomarkdoc/blob/master/testData/lang/function/func.go#L14>)
    43  
    44  ```go
    45  func Standalone(p1 int, p2 string) (int, error)
    46  ```
    47  
    48  Standalone provides a function that is not part of a type.
    49  
    50  Additional description can be provided in subsequent paragraphs, including code blocks and headers
    51  
    52  ### Header A
    53  
    54  This section contains a code block.
    55  
    56  ```
    57  Code Block
    58  More of Code Block
    59  ```
    60  
    61  <details><summary>Example</summary>
    62  <p>
    63  
    64  
    65  
    66  ```go
    67  package main
    68  
    69  import (
    70  	"fmt"
    71  
    72  	"github.com/dkischenko/gomarkdoc/testData/lang/function"
    73  )
    74  
    75  func main() {
    76  	res, _ := function.Standalone(2, "abc")
    77  	fmt.Println(res)
    78  }
    79  ```
    80  
    81  #### Output
    82  
    83  ```
    84  2
    85  ```
    86  
    87  </p>
    88  </details>
    89  
    90  <details><summary>Example (Zero)</summary>
    91  <p>
    92  
    93  
    94  
    95  ```go
    96  package main
    97  
    98  import (
    99  	"fmt"
   100  
   101  	"github.com/dkischenko/gomarkdoc/testData/lang/function"
   102  )
   103  
   104  func main() {
   105  	res, _ := function.Standalone(0, "def")
   106  	fmt.Println(res)
   107  }
   108  ```
   109  
   110  #### Output
   111  
   112  ```
   113  0
   114  ```
   115  
   116  </p>
   117  </details>
   118  
   119  <a name="Generic"></a>
   120  ## type [Generic](<https://github.com/dkischenko/gomarkdoc/blob/master/testData/lang/function/func.go#L33>)
   121  
   122  Generic is a struct with a generic type.
   123  
   124  ```go
   125  type Generic[T any] struct{}
   126  ```
   127  
   128  <a name="Generic[T].WithGenericReceiver"></a>
   129  ### func \(Generic\[T\]\) [WithGenericReceiver](<https://github.com/dkischenko/gomarkdoc/blob/master/testData/lang/function/func.go#L36>)
   130  
   131  ```go
   132  func (r Generic[T]) WithGenericReceiver()
   133  ```
   134  
   135  WithGenericReceiver has a receiver with a generic type.
   136  
   137  <details><summary>Example</summary>
   138  <p>
   139  
   140  
   141  
   142  ```go
   143  package main
   144  
   145  import (
   146  	"github.com/dkischenko/gomarkdoc/testData/lang/function"
   147  )
   148  
   149  func main() {
   150  	r := function.Generic[int]{}
   151  	r.WithGenericReceiver()
   152  }
   153  ```
   154  
   155  </p>
   156  </details>
   157  
   158  <a name="Receiver"></a>
   159  ## type [Receiver](<https://github.com/dkischenko/gomarkdoc/blob/master/testData/lang/function/func.go#L19>)
   160  
   161  Receiver is a type used to demonstrate functions with receivers.
   162  
   163  ```go
   164  type Receiver struct{}
   165  ```
   166  
   167  <details><summary>Example</summary>
   168  <p>
   169  
   170  
   171  
   172  ```go
   173  package main
   174  
   175  import (
   176  	"fmt"
   177  
   178  	"github.com/dkischenko/gomarkdoc/testData/lang/function"
   179  )
   180  
   181  func main() {
   182  	r := &function.Receiver{}
   183  	fmt.Println(r)
   184  }
   185  ```
   186  
   187  </p>
   188  </details>
   189  
   190  <details><summary>Example (Sub Test)</summary>
   191  <p>
   192  
   193  
   194  
   195  ```go
   196  package main
   197  
   198  import (
   199  	"github.com/dkischenko/gomarkdoc/testData/lang/function"
   200  )
   201  
   202  func main() {
   203  	var r function.Receiver
   204  	r.WithReceiver()
   205  }
   206  ```
   207  
   208  </p>
   209  </details>
   210  
   211  <a name="New"></a>
   212  ### func [New](<https://github.com/dkischenko/gomarkdoc/blob/master/testData/lang/function/func.go#L22>)
   213  
   214  ```go
   215  func New() Receiver
   216  ```
   217  
   218  New is an initializer for Receiver.
   219  
   220  <a name="Receiver.WithPtrReceiver"></a>
   221  ### func \(\*Receiver\) [WithPtrReceiver](<https://github.com/dkischenko/gomarkdoc/blob/master/testData/lang/function/func.go#L30>)
   222  
   223  ```go
   224  func (r *Receiver) WithPtrReceiver()
   225  ```
   226  
   227  WithPtrReceiver has a pointer receiver.
   228  
   229  <a name="Receiver.WithReceiver"></a>
   230  ### func \(Receiver\) [WithReceiver](<https://github.com/dkischenko/gomarkdoc/blob/master/testData/lang/function/func.go#L27>)
   231  
   232  ```go
   233  func (r Receiver) WithReceiver()
   234  ```
   235  
   236  WithReceiver has a receiver.
   237  
   238  Generated by [gomarkdoc](<https://github.com/dkischenko/gomarkdoc>)