Skip to content

Incorrect pointer to interface #2

Closed
@d-enk

Description

@d-enk

// Replace output when given type is `any` or `interface{}`, but not a custom interface.
func getInterfaceType(typeOfT reflect.Type) string {

Why?

package main

import (
	"fmt"

	typetostring "github.com/samber/go-type-to-string"
)

func main() {
	type I interface {}

	fmt.Println(typetostring.GetType[I]())   // *main.I
	fmt.Println(typetostring.GetType[*I]())  // *main.I
	fmt.Println(typetostring.GetType[**I]()) // **main.I
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions