A unified management method and device for package dependency management tools in Go language
Through the unified management of package dependency management tools for Go language, users can easily change tools without downloading and entering specific instructions, solving user inconvenience problems in the existing technology and improving user experience.
Patent Information
- Application Number
- CN201910229067.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-03-25
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2039-03-25
AI Technical Summary
In the prior art, when a user wants to replace the Go package dependency management tool, he needs to download the corresponding tool and enter specific instructions, which leads to inconvenience to the user.
It provides a unified management method for the Go package dependency management tool. By receiving the target package dependency management tool selected by the user and the input instructions, identifying and converting the instructions into the format of the target tool, and generating the Go language project directory and configuration file corresponding to the target tool.
It solves the problem that users need to download and enter specific instructions when changing package dependency management tools, simplifies the operation process and improves the user experience.
Smart Images

Figure CN111736886B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a unified management method and device for a package dependency management tool of the Go language Background Art
[0002] Go (also known as Golang) is a statically strongly typed, compiled, concurrent, and garbage collected programming language developed by Google. Based on the above advantages of the Go language, more and more programmers use the Go language to write engineering projects.
[0003] When establishing a Go language project, it is inevitable to use external dependency packages. Currently, most of them use special package dependency management tools to manage external dependency packages. Compared with Go language obtaining third-party libraries one by one through the go get command, the package dependency management tool can directly give the introduced third-party library package a special directory, and can specially formulate a configuration file to control the third-party libraries, versions and other dependencies introduced by the Go language project.
[0004] There are many package dependency management tools for Go language. You can manage external dependency packages by installing any one of them. However, there is a problem. When users do not want to use the current package dependency management tool to manage external dependency packages but want to use other package dependency management tools to manage external dependency packages, users need to download another package dependency management tool and enter the corresponding type of instructions, which brings great inconvenience to users. Summary of the invention
[0005] In view of the above problems, the present invention is proposed to provide a unified management method and device for package dependency management tools of the Go language that overcomes the above problems or at least partially solves the above problems.
[0006] An object of the present invention is to provide a unified management method for a package dependency management tool of the Go language, comprising:
[0007] Receive the target package dependency management tool selected by the user and the input instructions;
[0008] Identify and determine whether the instruction is an instruction in a format corresponding to the target package dependency management tool, and if not, convert the instruction into an instruction in a format corresponding to the target package dependency management tool;
[0009] Generate a directory and configuration file of a Go language project in a format corresponding to the target package dependency management tool according to the converted instructions.
[0010] Optionally, the configuration file includes information about a third-party class library that the Go language project depends on, and after generating a directory and a configuration file of the Go language project in a format corresponding to the target package dependency management tool according to the converted instructions, the method further includes:
[0011] Read information about a third-party class library that the Go language project depends on, which is recorded in a configuration file of the Go language project;
[0012] Download the corresponding third-party class library to the directory of the GO language project according to the information of the third-party class library.
[0013] Optionally, the package dependency management tool includes at least one of the following: dep, Godep, Gomod, Go vendor.
[0014] Optionally, before receiving the target package dependency management tool selected by the user and the input instruction, the method further includes:
[0015] storing the name of each package dependency management tool and its corresponding instructions; and
[0016] A one-to-one corresponding key-value pair is established and stored between each instruction of any two of the package dependency management tools.
[0017] Optionally, the identifying and determining whether the instruction is an instruction in a format corresponding to the target package dependency management tool includes:
[0018] Identify instructions of a corresponding format of the target package dependency management tool according to the names of the pre-stored package dependency management tools and their corresponding instructions;
[0019] Identify and determine whether the instruction input by the user is an instruction in a format corresponding to the target package dependency management tool.
[0020] Optionally, converting the instruction into an instruction in a format corresponding to the target package dependency management tool includes:
[0021] Determine the target key-value pair from the pre-stored key-value pairs according to the target package dependency management tool selected by the user and the input instructions;
[0022] The instructions input by the user are converted into instructions in a format corresponding to the target package dependency management tool according to the target key-value key value.
[0023] According to another aspect of the present invention, a unified management device for a package dependency management tool in a Go language is provided, comprising:
[0024] A receiving module, configured to receive a target package dependency management tool selected by a user and an input instruction;
[0025] an identification and judgment module, configured to identify and judge whether the instruction is an instruction in a format corresponding to the target package dependency management tool, and if not, convert the instruction into an instruction in a format corresponding to the target package dependency management tool;
[0026] The generation module is configured to generate a directory and a configuration file of a Go language project in a format corresponding to the target package dependency management tool according to the converted instructions.
[0027] Optionally, the configuration file includes information about a third-party class library that the Go language project depends on, and the device further includes:
[0028] A download module is configured to read information of a third-party class library that the Go language project depends on, which is recorded in a configuration file of the Go language project;
[0029] Download the corresponding third-party class library according to the information of the third-party class library to the directory of the Go language project.
[0030] Optionally, the package dependency management tool includes at least one of the following: dep, Godep, Gomod, Go vendor.
[0031] Optionally, the device further comprises:
[0032] A storage module configured to store the name of each package dependency management tool and its corresponding instructions; and
[0033] A one-to-one corresponding key-value pair is established and stored between each instruction of any two of the package dependency management tools.
[0034] Optionally, the identification and judgment module is further configured to:
[0035] Identify instructions of a corresponding format of the target package dependency management tool according to the names of the pre-stored package dependency management tools and their corresponding instructions;
[0036] Determine whether the instruction input by the user is an instruction in a format corresponding to the target package dependency management tool.
[0037] Optionally, the identification and judgment module is further configured to:
[0038] Determine the target key-value pair from the pre-stored key-value pairs according to the target package dependency management tool selected by the user and the input instructions;
[0039] The instructions input by the user are converted into instructions in a format corresponding to the target package dependency management tool according to the target key-value key value.
[0040] According to another aspect of the present invention, a computer storage medium is provided, which stores a computer program code. When the computer program code runs on a computing device, the computing device executes any one of the above-mentioned unified management methods for the Go language package dependency management tool.
[0041] According to yet another aspect of the present invention, there is further provided a computing device, comprising:
[0042] processor;
[0043] a memory storing computer program code;
[0044] When the computer program code is executed by the processor, the computing device is caused to execute any one of the above-mentioned unified management methods of the Go language package dependency management tool.
[0045] In an embodiment of the present invention, a target package dependency management tool selected by a user and an input instruction are received, and then the instruction input by the user is identified and determined to be an instruction in a format corresponding to the target package dependency management tool. If not, the instruction is converted into an instruction in a format corresponding to the target package dependency management tool, and then a directory and configuration file of a Go language project in a format corresponding to the target package dependency management tool are generated according to the converted instruction. In an embodiment of the present invention, when a user does not want to use the current Go language package dependency management tool to manage package dependencies, any other package dependency management tool can be selected as the target package dependency management tool, which solves the problem in the current technology that when a user wants to change the Go language package dependency management tool, the corresponding package dependency management tool needs to be downloaded, which saves the user trouble and greatly improves the user experience.
[0046] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below.
[0047] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Hereinafter, some specific embodiments of the present invention will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:
[0049] Figure 1 A schematic flow chart of a unified management method of a package dependency management tool of the Go language according to an embodiment of the present invention is shown;
[0050] Figure 2 A schematic flow chart of a unified management method of a package dependency management tool of the Go language according to a preferred embodiment of the present invention is shown;
[0051] Figure 3 A schematic flow chart of a unified management method of a package dependency management tool of the Go language according to another preferred embodiment of the present invention is shown;
[0052] Figure 4 A structural block diagram of a unified management device of a package dependency management tool of the Go language according to an embodiment of the present invention is shown;
[0053] Figure 5 It shows a structural block diagram of a unified management device of a package dependency management tool of the Go language according to a preferred embodiment of the present invention;
[0054] Figure 6 A structural block diagram of a unified management device for a package dependency management tool in the Go language according to another preferred embodiment of the present invention is shown. DETAILED DESCRIPTION
[0055] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0056] It should be noted that the technical features in the embodiment and optional embodiments of the present invention can be combined with each other under the premise of no conflict.
[0057] In order to solve the above technical problems, an embodiment of the present invention proposes a unified management method of a package dependency management tool of the Go language. Figure 1 The following is a schematic diagram of the unified management process of the Go language package dependency management tool according to an embodiment of the present invention. Figure 1 As shown, the method includes:
[0058] Step S102: receiving the target package dependency management tool selected by the user and the input command;
[0059] Step S104: identifying and determining whether the above instruction is an instruction in a format corresponding to the target package dependency management tool; if not, converting the above instruction into an instruction in a format corresponding to the target package dependency management tool;
[0060] Step S106: Generate a directory and configuration file of a Go language project in a format corresponding to the target package dependency management tool according to the converted instructions.
[0061] In an embodiment of the present invention, a target package dependency management tool selected by a user and an input instruction are received, and then the instruction input by the user is identified and determined to be an instruction in a format corresponding to the target package dependency management tool. If not, the instruction is converted into an instruction in a format corresponding to the target package dependency management tool, and then a directory and configuration file of a Go language project in a format corresponding to the target package dependency management tool are generated according to the converted instruction. In an embodiment of the present invention, when a user does not want to use the current Go language package dependency management tool to manage third-party dependency packages, any other package dependency management tool can be selected as the target package dependency management tool, which solves the problem in the current technology that when a user wants to change the Go language package dependency management tool, the corresponding package dependency management tool needs to be downloaded, which saves the user trouble and greatly improves the user experience.
[0062] In a preferred embodiment, the Go language project configuration file mentioned above contains information about third-party libraries that the Go language project depends on. The information about the third-party libraries is directly obtained into the configuration file by inputting corresponding instructions. Based on the above content, Figure 2 As shown, the embodiment of the present invention also includes: Step S108: reading the information of the third-party class library that the Go language project depends on recorded in the configuration file of the Go language project; downloading the corresponding third-party class library to the directory of the Go language project according to the information of the third-party class library.
[0063] After reading the configuration file of the Go language project and obtaining the third-party class library information, you can connect to the corresponding website on the Internet and download the corresponding third-party class library to the directory of the Go language project. Then you can directly reference the files in the third-party class library required by the project from the downloaded third-party class library.
[0064] In a preferred embodiment, the package dependency management tool includes at least one of the following: dep, Godep, Gomod, Govendor.
[0065] In a preferred embodiment, if Figure 3 As shown, before receiving the target package dependency management tool selected by the user and the input instruction, step S100 is also included:
[0066] The name of each package dependency management tool and its corresponding instruction are stored, and a one-to-one corresponding key-value pair is established and stored between each instruction of any two package dependency management tools. Specifically, a key-value pair is established between instructions with the same function of different package dependency management tools.
[0067] Based on this preferred embodiment, in the above step S104, identifying and judging whether the above instructions are instructions of the corresponding format of the target package dependency management tool specifically includes: according to the target package dependency management tool selected by the user, determining the instructions of the corresponding format of the target package dependency management tool from the pre-stored names of each package dependency management tool and their corresponding instructions; according to the determined instructions of the target package dependency management tool, judging whether the instructions input by the user are instructions of the corresponding format of the target package dependency management tool; if not, searching for the target key-value pair in the pre-established key-value pairs, and then converting all the instructions input by the user into instructions corresponding to the target package dependency management tool for execution according to the target key-value pair.
[0068] It should be noted that, the package dependency management tool to which the user belongs can also be determined from the names of the pre-stored package dependency management tools and their corresponding instructions based on the instructions input by the user, and it can be determined whether the package dependency management tool is the target package dependency management tool selected by the user. If not, similarly, the target key-value pair is found in the pre-established key-value pairs, and then all the instructions input by the user are converted into instructions corresponding to the target package dependency management tool and executed according to the target key-value pair.
[0069] In one example, the command input by the user is update, and Go vendor is selected as the target package dependency management tool. Then, according to the names of the stored package dependency management tools and their corresponding instructions, it is determined that update is not Govendor, the instruction corresponding to the target package dependency management tool. Then, according to the input instruction update, the selected target package dependency management tool Go vendor searches for the target key-value pair in the pre-established key-value pair, determines key-update, and value-modify in the corresponding Go vendor. Then, Go vendor-modify is directly used to execute, and the directory and configuration file of the Go language project in the Go vendor format are generated.
[0070] According to the above example, when the target package dependency management tool selected by the user is not Go vendor, but other package dependency management tools, the operation is essentially the same, and the update instruction is converted into an instruction in the format of the corresponding target package dependency management tool.
[0071] Based on the same inventive concept, an embodiment of the present invention also provides a unified management device for a package dependency management tool in the Go language, such as Figure 4 As shown, the device 400 includes:
[0072] A receiving module 410 is configured to receive a target package dependency management tool selected by a user and an input instruction;
[0073] The identification and judgment module 420 is configured to identify and judge whether the above instruction is an instruction in a format corresponding to the target package dependency management tool, and if not, convert the above instruction into an instruction in a format corresponding to the target package dependency management tool;
[0074] The generation module 430 is configured to generate a directory and a configuration file of a Go language project in a format corresponding to the target package dependency management tool according to the converted instructions.
[0075] The unified management device of the package dependency management tool of the Go language proposed in the embodiment of the present invention includes scaffolding of each package dependency management tool. The scaffolding is equivalent to a project template. After the user selects the target package dependency management tool and converts the input instructions into corresponding format instructions, the directory and configuration file of the Go language project in the corresponding format can be quickly generated. When a new package dependency management tool of the Go language appears, the scaffolding of the corresponding package dependency management tool can be obtained to generate the corresponding configuration file and directory when the user selects it.
[0076] In a preferred embodiment, the above configuration file contains information about the third-party libraries that the Go language project depends on, such as Figure 5 As shown, the above device 400 also includes:
[0077] The download module 440 is configured to read the information of the third-party class library that the Go language project depends on, which is recorded in the configuration file of the Go language project;
[0078] Download the corresponding third-party library according to the information of the third-party library to the directory of the Go language project.
[0079] In a preferred embodiment, the package dependency management tool includes at least one of the following: dep, Godep, Gomod, Go vendor.
[0080] In a preferred embodiment, if Figure 6 As shown, the above-mentioned device 400 also includes:
[0081] The storage module 450 is configured to store the name of each package dependency management tool and its corresponding instructions; and
[0082] A one-to-one corresponding key-value pair is established and stored between each instruction of any two package dependency management tools.
[0083] It should be noted that when a new package dependency management tool for the Go language appears, the corresponding package dependency management tool and the corresponding instructions will be stored, and at the same time, one-to-one key-value pairs will be established and stored between each instruction of the package dependency management tool and the instructions of the corresponding functions of other package dependency management tools.
[0084] In a preferred embodiment, the identification and judgment module 220 is further configured as follows:
[0085] Identify instructions of a corresponding format of a target package dependency management tool according to the names of the pre-stored package dependency management tools and their corresponding instructions;
[0086] Determine whether the instruction input by the user is an instruction in a format corresponding to the target package dependency management tool.
[0087] In a preferred embodiment, the identification and judgment module 220 is further configured as follows:
[0088] Determine the target key-value pair from the pre-stored key-value pairs according to the target package dependency management tool selected by the user and the input instructions;
[0089] Convert the instructions entered by the user into instructions in the corresponding format of the target package dependency management tool according to the target key-value.
[0090] According to another aspect of the present invention, a computer storage medium is provided, which stores computer program code. When the computer program code runs on a computing device, the computing device executes the unified management method of the Go language package dependency management tool in any of the above embodiments.
[0091] According to another aspect of the present invention, there is also provided a computing device, comprising:
[0092] processor;
[0093] a memory storing computer program code;
[0094] When the computer program code is executed by the processor, it causes the computing device to execute the unified management method of the Go language package dependency management tool in any of the above embodiments.
[0095] According to any one of the above preferred embodiments or a combination of multiple preferred embodiments, the embodiments of the present invention can achieve the following beneficial effects:
[0096] According to the technical solution of the present invention, a directory and configuration file of a Go language project in a corresponding format can be generated according to any package dependency management tool selected by the user, and the instructions input by the user can be converted into instructions in a corresponding format of the selected package dependency management tool, thereby eliminating the inconvenience of the user having to input instructions in a corresponding format according to different selected package dependency management tools. The operation is simple and easy to implement, which meets the different needs of users and greatly improves the user experience.
[0097] It will be apparent to those skilled in the art that the above described systems, in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting an intent that the claimed invention requires more features than those expressly recited in each claim. Rather, as reflected in the claims below, inventive aspects lie in less than all of the features of the individual embodiments disclosed above. Therefore, the claims that follow the detailed description are hereby expressly incorporated into the detailed description, with each claim standing on its own as a separate embodiment of the invention.
[0098] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0099] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims, any one of the claimed embodiments may be used in any combination.
[0100] At this point, those skilled in the art should recognize that, although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived based on the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all these other variations or modifications.
Claims
1. A unified management method for a package dependency management tool of the Go language, comprising: Receive the target package dependency management tool selected by the user and the input instructions; Identify and determine whether the instruction is an instruction in a format corresponding to the target package dependency management tool according to the names of the pre-stored package dependency management tools and their corresponding instructions; if not, convert the instruction into an instruction in a format corresponding to the target package dependency management tool according to the target key-value pair; Generate a directory and configuration file of a Go language project in a format corresponding to the target package dependency management tool according to the converted instructions.
2. The method according to claim 1, wherein: The configuration file includes information about the third-party class library that the Go language project depends on. After the directory and configuration file of the Go language project in the format corresponding to the target package dependency management tool are generated according to the converted instructions, the following is also included: Read information about a third-party class library that the Go language project depends on, which is recorded in a configuration file of the Go language project; Download the corresponding third-party class library according to the information of the third-party class library to the directory of the Go language project.
3. The method according to claim 1 or 2, wherein: Package dependency management tools include at least one of the following: dep, Godep, Go mod, Go vendor.
4. The method according to claim 1 or 2, wherein: Before receiving the target package dependency management tool selected by the user and the input instruction, the method further includes: storing the name of each package dependency management tool and its corresponding instructions; and A one-to-one corresponding key-value pair is established and stored between each instruction of any two of the package dependency management tools.
5. The method according to claim 4, wherein: The step of identifying and judging whether the instruction is an instruction in a format corresponding to the target package dependency management tool according to the names of the pre-stored package dependency management tools and the corresponding instructions includes: Identify instructions of a corresponding format of the target package dependency management tool according to the names of the pre-stored package dependency management tools and their corresponding instructions; Identify and determine whether the instruction input by the user is an instruction in a format corresponding to the target package dependency management tool.
6. The method according to claim 4, wherein: Before converting the instruction into an instruction in a format corresponding to the target package dependency management tool according to the target key-value pair, the method further includes: The target key-value pair is determined according to the target package dependency management tool selected by the user and the input instruction to the pre-stored key-value pair.
7. A unified management device for a package dependency management tool of a Go language, comprising: A receiving module, configured to receive a target package dependency management tool selected by a user and an input instruction; an identification and judgment module, configured to identify and judge whether the instruction is an instruction in a format corresponding to the target package dependency management tool according to the names of the pre-stored package dependency management tools and their corresponding instructions; if not, convert the instruction into an instruction in a format corresponding to the target package dependency management tool according to the target key-value pair; The generation module is configured to generate a directory and a configuration file of a Go language project in a format corresponding to the target package dependency management tool according to the converted instructions.
8. The device according to claim 7, wherein: The configuration file includes information about a third-party library that the Go language project depends on, and the device further includes: A download module is configured to read information of a third-party class library that the Go language project depends on, which is recorded in a configuration file of the Go language project; Download the corresponding third-party class library to the directory of the GO language project according to the information of the third-party class library.
9. The device according to claim 7 or 8, wherein: Package dependency management tools include at least one of the following: dep, Godep, Go mod, Go vendor.
10. The device according to claim 7 or 8, wherein: The device also includes: A storage module configured to store the name of each package dependency management tool and its corresponding instructions; and A one-to-one corresponding key-value pair is established and stored between each instruction of any two of the package dependency management tools.
11. The device according to claim 10, wherein: The identification and judgment module is also configured as follows: Identify instructions of a corresponding format of the target package dependency management tool according to the names of the pre-stored package dependency management tools and their corresponding instructions; Determine whether the instruction input by the user is an instruction in a format corresponding to the target package dependency management tool.
12. The device according to claim 10, wherein: The identification and judgment module is also configured as follows: The target key-value pair is determined according to the target package dependency management tool selected by the user and the input instruction to the pre-stored key-value pair.
13. A computer storage medium storing a computer program code, which, when executed on a computing device, causes the computing device to execute the unified management method for a package dependency management tool for the Go language as described in any one of claims 1 to 6.
14. A computing device comprising: processor; a memory storing computer program code; When the computer program code is executed by the processor, the computing device is caused to execute the unified management method of the Go language package dependency management tool as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method for solving start concurrence bottleneck of docker container
CN105824688A
Bug detecting method for Android mobile phone APP
CN107330332A