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

It would be good to support Doxygen or Javadoc style comments #23

Open
yjfvictor opened this issue May 18, 2021 · 1 comment
Open

It would be good to support Doxygen or Javadoc style comments #23

yjfvictor opened this issue May 18, 2021 · 1 comment

Comments

@yjfvictor
Copy link

https://www.doxygen.nl/index.html

https://www.oracle.com/technical-resources/articles/java/javadoc-tool.html

As the code below,

/**
 * @file test.go
 * @author your name (you@domain.com)
 * @brief a test file
 * @version 0.1
 * @date 2021-05-18
 *
 * @copyright Copyright (c) 2021
 *
 */
package main

import "fmt"

/**
 * @brief a function to swap two data
 *
 * @param[in,out] a   a pointer for the first element
 * @param[in,out] b   a pointer for the second element
 * @return int
 */
func my_swap_function(a *int, b *int) int {
	var t int = *a
	*a = *b
	*b = t
	return 0
}

/**
 * @brief main function
 */
func main() {
	var a int = 3
	var b int = 4
	var ret int = my_swap_function(&a, &b)
	if ret == 0 {
		fmt.Printf("%d %d\n", a, b)
	}
}

there is no any syntax highlight on the Doxygen comments.
go

But the C code works fine on Doxygen style syntax highlight.
c

Even the function toolbox supports Doxygen well.
c_toolbox

I hope this feature can be supported in Go as well.

@willfaught
Copy link

I understand the desire for consistency across languages, but Go has its own idiomatic comment format, and Doxygen support would only encourage non-idiomatic comments in Go. To be blunt,

/**
 * @brief a function to swap two data
 *
 * @param[in,out] a   a pointer for the first element
 * @param[in,out] b   a pointer for the second element
 * @return int
 */
func my_swap_function(a *int, b *int) int {
	var t int = *a
	*a = *b
	*b = t
	return 0
}

is the opposite of the idiomatic code that the Go community encourages (including the snake case function name, but I assume that's not your point here).

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

No branches or pull requests

2 participants