Looking for:
- The location of a function definition within a code file.
What I have:
- The code file.
- The byte index where the function definition begins and its length in bytes.
How can I determine the line number of this function in the file?
My plan:
- Read the code file as a byte array.
- Locate the function in the byte array using the start index and length.
- Convert the binary function to text.
- Convert the entire code file from binary to text.
- Number the lines within the text.
- Use pattern matching to identify the function's line number in the text.
I am utilizing Golang for the back-end service, which I believe will handle this task. However, I also have a front-end in JavaScript that I can utilize if necessary.