1, interview suggestion
Technical part
1) algorithm part, just brush LeetCode, this is a long-term process, short-term assault has no effect, because there are too many topics.
2) Language foundation, which is subdivided into: golang foundation and principle, which is the main content of this paper; Mysql foundation and principle; Redis Foundation and Principles; Linux common commands, such as timing scripts, what several parameters represent, file permissions need to be clear, and process memory occupation commands; Small companies need to know some front-end knowledge, because they want you to know everything.
It is suggested that you can brush the Golong question bank, which is well summarized and of high quality, which is convenient for consolidating the grammar foundation. You can also go to the front-end interview question bank, which is full of questions and answers, so that you can easily and quickly understand the front-end knowledge.
3) Project experience, you can build a web framework of back-end interface service based on gin, and generally ask you how to realize it; And microservices.
Non-technical part
1)HR can also fully prepare the answer to a question that may be asked. It doesn't mean that you won't answer, but it will make your expression smoother. Secondly, it also shows that you are prepared. In an interview with a company, I suffered losses and passed the technical test. HR said that my expressive ability is not good (I will share this template later, thanking my daughter-in-law for being an interviewer and guiding how to answer HR questions with high emotional intelligence).
2) You can record your interview answers and see your tone, volume and fluency. If you are uncomfortable after listening, the interviewer may be uncomfortable.
What's the difference between 1 and make and new in golang? (Basic questions)
* * * Similarity: Allocate memory to variables.
Difference:
1) variables have different types. New allocates memory for string, int and array, and make allocates memory for slice, map and channel.
2) The return types are different. New returns a pointer to a variable, and make returns the variable itself.
3) clear the space allocated by 3)new. After make allocates space, it will be initialized.
2, the difference between array and slice (basic must ask)
Similarities:
1) can only store a set of data structures of the same type.
2) They are all accessed through subscripts, and have capacity length, the length is obtained through len, and the capacity is obtained through cap.
Difference:
1) array is fixed-length, and access and copy cannot exceed the length defined by the array, otherwise the subscript will exceed the limit, and the slice length and capacity can be automatically expanded.
2) Arrays are value types, slices are reference types, and each slice references a bottom array. Slice itself can't store any data, but the bottom array stores data, so when you modify the slice, the data in the bottom array is modified. Once the slice is extended and points to the new underlying array, the memory address will change accordingly.
Concise answer:
1) has different definitions.
2) Different initialization methods. You need to specify the size of the array, and the size will not change. 3) In function transfer, array slices are all value transfer.
3. Will its address change because of its scope?
A: In fora, b:=rangec traversal, A and B will only exist once in memory, that is, the data traversed in each loop will be assigned to A and B by value overwriting, and the memory addresses of A and B will remain unchanged. Because of this feature, if you open a contract in a for loop, don't directly pass the address of A or B to the contract.
Solution: Create a temporary variable in each loop.
4. Godford, the order of multiple extensions. When will the delay modify the return value?
Function: Delay function, release resources and finish the work. Such as releasing locks, closing files and closing links. Catch the panic.
Pit avoidance guide: defer function is opened immediately after the resource, otherwise defer may not be executed, resulting in memory leakage.
The order of many defer calls is LIFO (last in first out), and the operation after defer can be understood as pushing defer, return and returnvalue (function return value) onto the stack.
Execution order: return first, then returnvalue, and finally defer. Defer can modify the final return value of a function.
When to modify: name the return value or function return pointer.
5. Can you introduce the types of runes?
The underlying implementation of strings in golang is realized by byte arrays. Chinese characters account for 2 bytes under unicode, 3 bytes under utf-8 encoding, and the default encoding of golang is utf-8.
Byte is equivalent to int8 and is often used to process ascii characters.
Rune is equivalent to int32 and is usually used to process unicode or utf-8 characters.